请输出他们的平均分和高于平均分的同学姓名。
using System;
using System.Collections.Generic;
using System.Text;
namespace projAboveAvg
{
class Program
{
static void Main(string[] args)
{
string[,] score = { { "景珍", "90" }, { "林惠祥", "65" }, { "成蓉", "88" }, { "洪南昌", "70" },
{ "龙玉民", "46" }, { "单江开", "81" }, { "田武山", "100" }, { "王三明", "68" } };
int sum=0;
int avg=0;
int test=0 ;
int i;
string name = "";
for (i = 0; i < score.GetLongLength(0); i++)
{
test = Convert.ToInt32(score[i, 1]);
sum = sum+test;
name = score[i, 0];
}
avg=sum/(score.Length/2);
Console.Write("平均分是"+avg+"高于平均分的有:");
for (i = 0; i < score.GetLongLength(0); i++)
{
name = score[i, 0];
if(Convert.ToInt32(score[i, 1])>avg)
Console.Write(name);
}
}
}
}