0% found this document useful (0 votes)
235 views2 pages

Mayor Menor e Intermedio C#

The document contains code that takes in 3 numbers as input from the user, compares the numbers, and identifies the largest (mayor), smallest (menor), and intermediate (inter) values. It also checks for equality between the numbers and outputs the results along with any relevant observations.

Uploaded by

Alex P. Ayme
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
235 views2 pages

Mayor Menor e Intermedio C#

The document contains code that takes in 3 numbers as input from the user, compares the numbers, and identifies the largest (mayor), smallest (menor), and intermediate (inter) values. It also checks for equality between the numbers and outputs the results along with any relevant observations.

Uploaded by

Alex P. Ayme
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

int n1, n2, n3, mayor, menor, inter;

string obser = "";


Console.Write("Escribe primer numero ");
n1 = int.Parse(Console.ReadLine());
Console.Write("Escribe segundo numero ");
n2 = int.Parse(Console.ReadLine());
Console.Write("Escribe tercer numero ");
n3 = int.Parse(Console.ReadLine());
mayor = menor = inter = n1;
if (n2 > mayor)
{
mayor = n2;
}
if (n3 > mayor)
{
mayor = n3;
}
if (n2 < menor)
{
menor = n2;
}
if (n3 < menor)
{
menor = n3;
}
if ((n1 > menor) && (n1 < mayor))
{
inter = n1;
}
if ((n2 > menor) && (n2 < mayor))
{
inter = n2;
}
if ((n3 > menor) && (n3 < mayor))
{
inter = n3;
}
if (n1 ==
{
inter
obser
}
if (n2 ==
{
inter
obser
}

n2)
= 0;
= "p y s son iguales";
n3)
= 0;
= "s y t son iguales";

if (n1 == n3)
{
inter = 0;
obser = "p y t son iguales";
}
if ((n1 == n2) && (n1 == n3))
{

inter = 0;
menor = 0;
mayor = 0;
obser = "p, s y t son iguales";
}
Console.WriteLine("\n n1 \t n2 \t n3 \t Mayor \t intermedio \t menor
\t observaciones ");
Console.WriteLine("\n---------------------------------------------------------------------------");
Console.WriteLine("\n" + n1 + "\t" + n2 + "\t" + n3 + "\t" + mayor +
"\t" + inter + "\t" + menor + "\t" + obser);
Console.ReadKey();

You might also like