2018-10-25

2018-11-08  本文已影响0人  be1058558528

让用户输入姓名 语文 数学 英语 三门课的成绩,然后给用户显示: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();

上一篇 下一篇

猜你喜欢

热点阅读