美文网首页
2018-10-25

2018-10-25

作者: be1058558528 | 来源:发表于2018-11-08 14:43 被阅读0次

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

    Console.WriteLine("请输入姓名");

    string strxingming =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 match = Convert.ToInt32(strmath);

    int english = Convert.ToInt32(strenglish);

    double zhongfen = chinese + match + english;

    double pingjunfen = zhongfen / 3;

    Console.WriteLine("{0},你的总成绩为{1}分,平均成绩{2}分",strxingming,zhongfen,pingjunfen);

    Console.ReadKey();

    相关文章

      网友评论

          本文标题:2018-10-25

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