namespace ConsoleApplication18 { class Program { static void Main(string[] args) { ArrayList al = new ArrayList(); Console.Write("请输入评为人数:"); int n = Convert.ToInt32(Console.ReadLine()); for (int i = 0; i < n; i++) { Console.Write("第" + (i + 1) + "评为的评分为:");//;利用for循环把输入的数放入集合中 al.Add(Convert.ToInt32(Console.ReadLine())); } al.Sort();//从小到大排序 for (int k = 0; k < n; k++) { Console.WriteLine(al[k]); } Console.WriteLine("以上为成绩升序"); Console.ReadLine(); double sum = 0; for (int j = 0; j < n; j++)//计算总分 { sum = sum + Convert.ToDouble(al[j]); } double avg = (sum - Convert.ToDouble(al[0]) - Convert.ToDouble(al[n])) / (n - 2); Console.WriteLine("总成绩为:"+sum); Console.WriteLine(n + "个人的平均分数为:" + avg); Console.ReadLine(); } } }