CATEDRATICO: Ing Juan Espinoza.
PROGRAMACION.NET
PRACTICA
MAYOR, MENOR DE TRES NUMEROS
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MAYORMENORIGUAL
{
class Program
{
static void Main(string[] args)
{
int X,Y;
Console.WriteLine("Ingrese un numero");
int A = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("Ingrese un numero");
int B = Convert.ToInt16(Console.ReadLine());
Console.WriteLine("Ingrese un numero");
int C = Convert.ToInt16(Console.ReadLine());
if (A > B && A > C)
{
X = A;
}
else
{
if (B > A && B > C )
{
X = B;
}
else
{
if (C > A && C > B)
{
X = C;
}
else
X = C;
}
}
if (A < B && A < C)
{
Y = A;
}
else
{
if (B < A && B < C)
{
Y = B;
}
else
{
if (C < A && C < B)
{
Y = C;
}
else
{
Y = C;
}
}
}
Console.WriteLine("el mayor es " + X + " y el menor es " + Y);
Console.ReadLine();
}
}
}
No hay comentarios:
Publicar un comentario