输入分数看看及格,一元二次方程,标准体重
Console.Write("请输入你的姓名:");
string name = Console.ReadLine();
Console.Write("请输入你的分数:");
double fenshu = Convert.ToDouble(Console.ReadLine());
if (fenshu >= 60 && fenshu < 80)
{
Console.WriteLine("恭喜你" + name + ",及格了");
}
if (fenshu < 100 && fenshu >= 80)
{
Console.WriteLine("恭喜你" + name + ",80+");
}
if (fenshu >= 100)
{
Console.WriteLine("恭喜你" + name + ",满分");
}
if (fenshu < 60 && fenshu > 50)
{
Console.WriteLine(name + "60-50");
}
if (fenshu < 50 && fenshu >= 0)
{
Console.WriteLine(name + "小于50");
}
if (fenshu < 0 && fenshu > 100)
{
Console.WriteLine("输入有误");
}
Console.WriteLine("求方程式ax*x+bx+c=0");
Console.Write("请输入a=");
double a = double.Parse(Console.ReadLine());
Console.Write("请输入b=");
double b = double.Parse(Console.ReadLine());
Console.Write("请输入c=");
double c = double.Parse(Console.ReadLine());
double de = b * b - 4 * a * c;
if (a == 0)
{
Console.WriteLine("不是一元二次方程");
}
else
{
Console.WriteLine("是一元二次方程");
if (de >= 0)
{
double x1 = (-b + Math.Sqrt(de)) / (2 * a);
double x2 = (-b - Math.Sqrt(de)) / (2 * a);
if (de > 0)
{
Console.WriteLine("方程式有两个不同的实根");
Console.WriteLine("x1=" + x1 + "x2=" + x2);
}
else
{
Console.WriteLine("方程式有两个相同的实根");
Console.WriteLine("x1=x2=" + x1);
}
}
else if (de < 0)
{
Console.WriteLine("方程式没有实根");
}
}
Console.ReadLine();
Console.Write("请输入您的性别:");
string xingbie = Console.ReadLine();
Console.Write("请输入您的身高:");
double shengao = Convert.ToDouble(Console.ReadLine());
Console.Write("请输入您的体重:");
double tizhong = Convert.ToDouble(Console.ReadLine());
double n1 = shengao - tizhong - 100;
double n2 = shengao - tizhong - 110;
if (xingbie == "男")
{
if (n1 <= 3 && n1 >= -3)
{
Console.WriteLine("nice");
}
else if (n1 > 3)
{
Console.WriteLine("胖");
}
else
{
Console.WriteLine("瘦");
}
}
else if (xingbie == "女")
{
if (n2 <= 3 && n2 >= -3)
{
Console.WriteLine("nice");
}
else if (n2 > 3)
{
Console.WriteLine("胖");
}
else
{
Console.WriteLine("瘦");
}
}
else
{
Console.WriteLine("您输入有误");
}