Two examples are written in two different ways
One is a console.write ();
One no, both of them can be
Standard weight
Men's weight = height-100 +-3
Kgcm
Female weight = height-110 +-3
Console.Write ("Please enter gender");
String xb = Console.ReadLine ();
Console.Write ("Please enter your weight");
Double TZ = Double. Parse (Console.ReadLine ());
Console.Write ("Please enter your height");
Double sg = double. Parse (Console.ReadLine ());
if (XB = = "Male")
{
Double n = tz-sg + 100;
if (n <= 3 && 3 <= N)
{
Console.WriteLine ("Standard Weight");
}
else if (n <-3)
{
Console.WriteLine ("Eat a little more");
}
Else
{
Console.WriteLine ("Eat Less");
}
}
else if (XB = = "female")
{
Double m = tz-sg + 110;
if (M <= 3 &&-3 <= m)
{
Console.WriteLine ("Standard Weight");
}
else if (M <-3)
{
Console.WriteLine ("Eat a little more");
}
Else
{
Console.WriteLine ("Eat Less");
}
}
Please enter your score: "
Less than 0, greater than 100, "the input score is wrong!" ”
Greater than 0, less than 10, "less lattice! Learn the slag! ”
Less than 60, "the inferior lattice! Keep trying! ”
Greater than or equal to 60, "Congratulations! Passed the exam! ”
Greater than or equal to 90, "Genius! It's awesome! ”
String Fenshu = "Please enter your score";
Console.WriteLine (Fenshu);
string x = Console.ReadLine ();
int fs = Convert.ToInt32 (x);
if (FS < 0 | | FS > 100)
{
Console.WriteLine ("Input error, please re-enter");
}
else if (fs > 0 && FS < 10)
{
Console.WriteLine ("Fail, learn Slag");
}
else if (<= FS && FS < 60)
{
Console.WriteLine ("Fail, next effort");
}
else if (fs > && FS < 90)
{
Console.WriteLine ("Congratulations, you passed");
}
else if (fs > && FS > 60)
{
Console.WriteLine ("Genius Ah");
}
Classic examples of C # language