第三次作业第二题

2018-10-25  本文已影响0人  皮皮虾_98e9

代码

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
上一篇 下一篇

猜你喜欢

热点阅读