记录一下学习
var names = new string[] { "景珍", "林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" }; var score = new int[] { 90, 65, 88, 70, 46, 81, 100, 68 }; int sum = 0; int avg = 0; int index = 0; for (int x = 0; x < score.Length; x++) { sum += score[x]; } avg = sum / score.Length; Console.WriteLine("平均分是" + avg + ",高于平均分的有:"); for (int e = 0; e < score.Length; e++) { if (avg < score[e]) { index = e; } else { continue; } Console.Write(names[index] + " "); }