美文网首页
第3节课第二个作业

第3节课第二个作业

作者: Deku啊 | 来源:发表于2018-10-25 09:16 被阅读0次

    #作业目标:让用户输入姓名 语文 数学 英语 三门课的成绩,然后给用户显示:XX,你的总成绩为XX分,平均成绩为XX分 

    ##代码

    Console.WriteLine("请首先输入你的名字");

                string nam1 = Console.ReadLine();

                Console.WriteLine("请首先输入你的语文成绩");

                string strChinese = Console.ReadLine();

                Console.WriteLine("在输入你的数学成绩");

                string strMath = Console.ReadLine();

                Console.WriteLine("在输入你的英语成绩");

                string strEnglish = Console.ReadLine();

                int chinese = Convert.ToInt32(strChinese);

                int math = Convert.ToInt32(strMath);

                int english = Convert.ToInt32(strEnglish);

                int totol = chinese + math + english;

                double average = totol / 3;

                Console.WriteLine("{0},总分{1},平均分{2}", nam1, totol, average);

                Console.ReadKey();

    ###实际效果图

    相关文章

      网友评论

          本文标题:第3节课第二个作业

          本文链接:https://www.haomeiwen.com/subject/yhfqtqtx.html