string[] name = new string[] { "景珍", "林惠洋", "成蓉", "洪南昌", "龙玉民", "单江开", "田武山", "王三明" };
int[] fen = { 90, 65, 88, 70, 46, 81, 100, 68 };
int pj = 0;
for (int i = 0; i < fen.Length; i++)
{
pj += fen[i];
}
pj = pj / 8;
Console.WriteLine("平均分是" +pj +",高于平均分的有:");
// Console.WriteLine(pj);
for (int a = 0; a < fen.Length; a++)
{
if (fen[a] > pj)
{
Console.Write(name[a]+ " ");
}
}
string[]name=new string[]{"景珍","林惠洋","成蓉","洪南昌","龙玉民","单江开","田武山","王三明"}; int[]score=new int[]{90,65,88,70,46,81,100,68}; int sum=0; int avg; for(int i=0;i<score.Length;i++) { sum +=score[i]; } avg =sum/score.Length; Console.Write("平均分是"+avg+","); Console.WriteLine("高于平均分的有:"); for(int j=0;j<score.Length;j++) { if(avg<score[j]) { Console.Write(name[j]+" "); } else { continue; } }
你看一下:或是,之类的是否是用全角汉字打出来的,这个测试对这方面有限制