美文网首页
第三次作业第二题

第三次作业第二题

作者: 皮皮虾_98e9 | 来源:发表于2018-10-25 09:21 被阅读0次

    代码

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;

    namespace ConsoleApplication2
    {
    class Program
    {
    static void Main(string[] args)
    {
    /**
    * 让用户输入姓名 语文 数学 英语三门成绩,然后显示。
    * */
    Console.WriteLine("请输入您的姓名");
    string str_name = Console.ReadLine();
    Console.WriteLine("请输入您的语文成绩");
    string str_chinese = Console.ReadLine();
    Console.WriteLine("请输入您的数学成绩");
    string str_math = Console.ReadLine();
    Console.WriteLine("请输入您的英语成绩");
    string str_english=Console.ReadLine();
    int chinese = Convert.ToInt32(str_chinese);
    int math = Convert.ToInt32(str_math);
    int english = Convert.ToInt32(str_english);
    int chengji = chinese + math + english;
    Console.WriteLine("{0}, 你的总成绩为{1}, 你的平均分为{2}", str_name, chengji, chengji / 3);
    Console.ReadKey();
    }
    }
    }

    效果

    IMG_0093.JPG

    相关文章

      网友评论

          本文标题:第三次作业第二题

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