代碼
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
/**
* 讓用戶輸入姓名 語文 數(shù)學(xué) 英語三門成績,然后顯示。
* */
Console.WriteLine("請輸入您的姓名");
string str_name = Console.ReadLine();
Console.WriteLine("請輸入您的語文成績");
string str_chinese = Console.ReadLine();
Console.WriteLine("請輸入您的數(shù)學(xué)成績");
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}, 你的總成績?yōu)閧1}, 你的平均分為{2}", str_name, chengji, chengji / 3);
Console.ReadKey();
}
}
}