qq_慕的地6528064
2019-11-14 20:36
string[] name = new string[] { "景珍", "林慧洋", "成蓉", "红南昌", "龙王民", "单开江", "田武山", "王三明" };
int[] score = new int[] { 90,65,88,70,46,81,100,68};
int sum = 0;
for (int i = 0; i < score.Length; i++)//求得总分
{
sum += score[i];
}
double agv = sum / score.Length;//求得平均分
Console.WriteLine("平均分是{0},高于平均分的有:",agv);
for (int i = 0; i < score.Length; i++)
{
if (score[i]>agv)
{
Console.Write(name[i]+" ");
}
}
你这上边写的score数组的循环,name[i]有没有循环,肯定报错啊,第二个循环有错,仔细看一下
C#开发轻松入门
254118 学习 · 1459 问题
相似问题