C#轻松入门6-8最终项目,求助,我这个代码哪里错了
求助,我这个代码哪里错了
string[] name ={"景珍","林惠阳","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"};
int[] score ={90,65,88,70,46,81,100,68};
int sum=0,avg;
foreach(int i in score){
sum+=sum[i];
}
avg=sum/score.Length;
Console.WriteLine("平均分是"+avg,"高于平均分的有:");
for(int x=0; x<score.Length; x++){
if(score [x]>avg){
Console.Write(name[x]+" ");
}
}