static void Main(string[] args)
{
int[] number = new int [3];
int temp;
Console.WriteLine("输入3个不同整数abc,输出中间值.");
Console.Write("请输入整数a的值:");
number[0] = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("a={0}", number[0]);
Console.Write("请输入整数b的值:");
number[1] = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("b={0}", number[1]);
Console.Write("请输入整数c的值:");
number[2] = Convert.ToInt32(Console.ReadLine());
Console.WriteLine("c={0}", number[2]);
for (int i = 0; i < 2; i++)
{
for (int j = i + 1; j < 3; j++)
{
if (number[i] > number[j])
{
temp = number[i];
number[i] = number[j];
number[j] = temp;
Console.WriteLine("number[i]={0}, number[j]={1}", number[i], number[j]);
}
}
}
Console.WriteLine("中间数为:" + number[1]);
Console.Read();
}