Application of Learning Summary condition statement

Source: Internet
Author: User

If

if {}else{}

if{}elseif{}else{} =if{}else{}if{}else{}

Double equals sign inside if bracket

Standard weight test:

Console.Write ("Please enter your name:");
string s = Console.ReadLine ();
Console.Write ("Please enter your gender:");
String a = Console.ReadLine ();
Console.Write ("Please enter your weight:");
int d = Int. Parse (Console.ReadLine ());
Console.Write ("Please enter your height:");
int c = Int. Parse (Console.ReadLine ());

if (a = = "male")
{
int q = d-c + 100;
if (q >=-3 && q <= 3)
{
Console.Write ("You are the standard weight");
}
else if (Q > 3)
{
Console.Write ("You are overweight, it's time to lose weight");
}
else if (Q <-3)
{
Console.Write ("Your weight is thin, it's time to fatten up");

}


}
Else
{
int q = d-c + 100;
if (q >=-3 && q <= 3)
{
Console.Write ("You are the standard weight");
}
else if (Q > 3)
{
Console.Write ("You are overweight, it's time to lose weight");
}
else if (Q <-3)
{
Console.Write ("Your weight is thin, it's time to fatten up");

}
Console.ReadLine ();
}
}
}
}

Application of Learning Summary condition statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.