using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MyFirstApp
{
class Program
{
static void Main(string[] args)
{
string[,] student = new string[,] {{"景珍","90"},{"林惠洋","65"},{"成蓉","88"},{"洪南昌","70"},{"龙玉民","46"}
,{"单江开","81"},{"田武山","100"},{"王三明","68"}};
int sum = 0, avg=0;
for (int i = 0; i < student.Length/2; i++) {
sum += Convert.ToInt32(student[i, 1]);
}
avg = sum /(student.Length/2);
Console.WriteLine("平均分是"+avg+",高于平均分的有:");
for (int i = 0; i < student.Length / 2; i++) {
if (Convert.ToInt32(student[i, 1])> avg) {
Console.WriteLine(student[i, 0] + " ");
}
}
}
}
}
c#动脑小题目2
猜你喜欢
转载自blog.csdn.net/cameronanderson/article/details/79464585
今日推荐
周排行