int[] a = new int[3];
//用数组存数
for (int i = 0; i < a.Length; i++)
{
Console.WriteLine("输入第{0}个数字", i + 1);
a[i] = Int32.Parse(Console.ReadLine());
}
//比较后在排序
for (int i = 0; i < a.Length-1; i++)
{
if (a[i] > a[i + 1])
{
int tp = a[i];
a[i] = a[i + 1];
a[i + 1] = tp;
}
}
//然后输出结果
for (int i = 0; i < a.Length; i++)
{
Console.Write(a[i] + " ");
}