为什么会运行两次

来源:3-2 C#中判断和分支

一oO

2015-11-03 11:45

 string[] name = new string[2];
            int[] score = new int[2];
            for (int i = 0; i < name.Length; i++)
            {
                Console.Write("请输入第" + (i + 1) + "名的姓名:");
                name[i] = Console.ReadLine();
                Console.Write("请输入第" + (i + 1) + "名的分数:");
                score[i] = int.Parse(Console.ReadLine());
            }
            int sum = 0, avg;
            int j = 0;
            for (int i = 0; i < score.Length; i++)
            {
                {
                    sum += score[i];
                }
                avg = sum /( score.Length);
                {



                    if (score[i] > avg)


                        j = i;
                }
                score[i] = avg;



                Console.Write("平均值:{0}高于平均值的同学:{1}", avg, name[i]);


写回答 关注

1回答

  • 冯立挺
    2015-11-06 20:07:20

    傻逼啊

C#开发轻松入门

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

254118 学习 · 1459 问题

查看课程

相似问题