换个写法,随便写写
string[] name = {"景珍","林惠洋","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"};
int[] score = {90,65,88,70,46,81,100,68};
int avg = 0;
int sum = 0;
int j = 0;
foreach ( int i in score )
sum += i;
avg = sum / score.Length;
Console.WriteLine("平均分是"+ avg + ",高于平均分的有:");
foreach (int i in score) {
if ( i > avg ) {
Console.Write(name[j] + " ");
}
j++;
}