1.半径为5的圆
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
int r = 5;
double pi = 3.14;
double total1 = pi * r * r;
double total2 = pi * 2 * r;
Console.WriteLine("面积是{0},周长是{1}", total1, total2);
Console.ReadKey();
}
}
}
2.语数英成绩
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入你的姓名");
string name=Console.ReadLine();
Console.WriteLine("请输入你的语文成绩");
string str_Chinese = Console.ReadLine();
double chinese = Convert.ToDouble(str_Chinese);
Console.WriteLine("请输入你的数学成绩");
string str_Math= Console.ReadLine();
double math = Convert.ToDouble(str_Math);
Console.WriteLine("请输入你的英语成绩");
string str_English = Console.ReadLine();
double english = Convert.ToDouble(str_English);
int Chinese = Convert.ToInt32(str_Chinese);
int Math = Convert.ToInt32(str_Math);
int English = Convert.ToInt32(str_English);
//总分
int total = Chinese + Math + English;
//平均分
double avg = total / 3.0;
Console.WriteLine("总共应付:{0},平均分是:{1}", total,avg);
Console.ReadKey();
}
}
}