//输入3个数,将这三个数从大到小排列打印出来;
Console.Write("请输入第一个数字:");
int a = int.Parse(Console.ReadLine());
Console.Write("请输入第一个数字:");
int b = int.Parse(Console.ReadLine());
Console.Write("请输入第一个数字:");
int c = int.Parse(Console.ReadLine());
if(a>=b&&a>=c)
{
if(b>=c)
{
Console.WriteLine(a);
Console.WriteLine(b);
Console.WriteLine(c);
}
else
{
Console.WriteLine(a);
Console.WriteLine(c);
Console.WriteLine(b);
}
}
if (b >= a && b>= c)
{
if (a >= c)
{
Console.WriteLine(b);
Console.WriteLine(a);
Console.WriteLine(c);
}
else
{
Console.WriteLine(b);
Console.WriteLine(c);
Console.WriteLine(a);
}
}
if (c >= a && a >= b)
{
if (a >= b)
{
Console.WriteLine(c);
Console.WriteLine(a);
Console.WriteLine(b);
}
else
{
Console.WriteLine(c);
Console.WriteLine(b);
Console.WriteLine(a);
}
}
Console.ReadLine();
时间: 2024-10-12 13:25:38