static void Main(string[] args)
{
Console.WriteLine("请输入第一个数:");
int shu1=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("请输入第二个数:");
int shu2 = Convert.ToInt32(Console.ReadLine());
int sum;
if(shu1>shu2)
{
sum = 0;
}
else if (shu1 < shu2)
{
sum = 1;
}
else
{
sum = 2;
}
switch(sum)
{
case 0:
Console.WriteLine("最大值:{0},最小值:{1}",shu1,shu2);
break;
case 1:
Console.WriteLine("最大值:{0},最小值:{1}", shu2, shu1);
break;
case 2:
Console.WriteLine("两数相等");
break;
}
}
更多信息请查看IT技术专栏