static void Main(string[] args)
{
string[]name=new string[]{"景珍","林慧洋","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"};
int[]grade=new int[]{90,65,88,70,46,81,100,68};
int sum;
int avg;
for(int i=0;i<8;i++)
{
sum+=grade[i];
}
avg=sum/8;
Console.WriteLine("平均分是"+avg+",高于平均分的有:");
for(int n=0;n<8;n++)
{
if(grade[n]>avg)
Console.Write(name[n]+" ");
}
}我知道不是语法的问题
厉害哦
我找到那个字打错了谢谢大家了
我后来改成int sum=0;了所以不存在调用未赋值变量的问题