2-19
最后任务
namespace csharp
{
class Program
{
static void Main(string[] args)
{
int i,avg,sum=0;
string[,] a = new string[8, 2] { {"景珍","90"}, {"林慧洋","65" }, { "成蓉","88"}, { "洪南昌","70"}, {"龙玉民","46" }, {"单开江","81" }, {"田武山","100" }, { "王三明","68"} };
for (i=0;i<a.GetLongLength(0);i++)
{
sum += int.Parse(a[i,1]);
}
avg = sum / 8;
Console.Write ("平均分是{0},",avg);
Console.WriteLine(" 高于平均分的有:");
for (i = 0; i < a.GetLongLength(0); i++)
{
if (int.Parse(a[i, 1]) > avg)
Console.Write(a[i,0]+" ");
}
}
}
}
举报