2-19

来源:2-19 C#的逻辑运算符(二)

慕沐1208226

2017-05-19 15:39

最后任务

写回答 关注

1回答

  • 来来lan
    2017-05-19 19:54: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]+" ");
                }
            }
        }
    }

C#开发轻松入门

本门课程是C#语言的入门教程,将带你轻松入门.NET开发

254118 学习 · 1459 问题

查看课程

相似问题