C#作業(yè)7

作業(yè)要求

讓用戶輸入姓名 語文 數(shù)學(xué) 英語 三門課的成績,然后給用戶顯示:XX,你的總成績?yōu)閄X分,平均成績?yōu)閄X分

代碼

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

namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("請首先輸入您的姓名");
string name = Console.ReadLine();
Console.WriteLine("再輸入您的語文成績");
string strChinese = Console.ReadLine();
Console.WriteLine("再輸入您的數(shù)學(xué)成績");
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 total = chinese + math+english;
        double pj = total / 3;

        Console.WriteLine("您好,{0},你的總成績?yōu)閧1}分,平均成績?yōu)閧2}分", name, total, pj);

        Console.ReadKey();

效果

圖片發(fā)自簡書App
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容