输入三个数,求最大的

时间:2010-05-30 17:22:07
【文件属性】:
文件名称:输入三个数,求最大的
文件大小:683B
文件格式:TXT
更新时间:2010-05-30 17:22:07
123 using System;

public class A
{
static void Main()
{
int z;
int[] a = new int[3];
Console.WriteLine("请输入三个数");
for (int i = 0; i < a.Length; i++)
{
a[i] = Convert.ToInt32(Console.ReadLine());
}
for (int d = a.Length-1; d > 0; d--)
for (int i = 0; i < a.Length-1; i++)
{
if (a[i] < a[i + 1])
{
z = a[i + 1];
a[i + 1] = a[i];
a[i] = z;
}
}
Console.WriteLine("最大数为");
Console.WriteLine(a[0]);
}
}



网友评论