作者在 2020-03-02 14:41:16 发布以下内容
int[] shuzu = new int[111];
string xinm = "";//缘由https://ask.csdn.net/questions/1056757
Console.Write("输入人员数量:");
int lian = int.Parse(Console.ReadLine()), j = 0;
while (lian > j)
{
Console.Write("输入姓名:");
xinm = Console.ReadLine();
Console.Write("输入 " + xinm + " 年龄:");
shuzu[j++] = int.Parse(Console.ReadLine());
}
Console.Write("年龄:");
while (0 < j) Console.Write(shuzu[--j].ToString() + " ");
Console.WriteLine();
Console.WriteLine("平均年龄:"+(shuzu.Sum() / lian).ToString());