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

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

static void Main(string[] args)
        {
            //用户输入
            Console.Write("请输入姓名:");
            string name = Console.ReadLine();
            Console.Write("请输入语文成绩:");
            decimal chinese = Convert.ToDecimal(Console.ReadLine());
            Console.Write("请输入数学成绩:");
            decimal mathematics = Convert.ToDecimal(Console.ReadLine());
            Console.Write("请输入英语成绩:");
            decimal english = Convert.ToDecimal(Console.ReadLine());
            Console.WriteLine("----------------------信息展示-----------------------");
            Console.WriteLine(name + ",你的总成绩为:" + (chinese + mathematics + english) + "分,平均成绩为:" + (chinese + mathematics + english) / 3 + "分。");
            Console.ReadKey();
        }

温馨提示:答案为网友推荐,仅供参考
相似回答