Statement:
Branching statements: if,if else,if ElseIf else,switch case
Looping statements: For,while,do While,foreach
Jump statement: Break,continue
Exception statement: Try Catch finally
Branch statements:
int a=5;
if (a>0)
{
Console.WriteLine ("This is a positive number");
}
Esle//If the a<=0 is executed, the subsequent statement is performed and the subsequent statement is always executed if no else is added
{
Console.WriteLine ("This is a number less than or equal to 0");
}
else if (a>10)
{
Console.WriteLine ("This is a number greater than 10");
}
2014-12-11
If statement
Title (1) Enter the year to determine whether it is leap years
(2) Determine if a date is correct
(3) Determine if weight is a standard weight
(4) and computer scissors
(5) Judging the equation of one yuan and two times
Switch case
int I=int. Parse (Console.ReadLine ());
Switch (i)
{
Case 1:
Console. WriteLine ("Monday");
Break
Case 2:
Console. WriteLine ("Tuesday");
Break
Case 3:
Console. WriteLine ("Wednesday");
Break
Case 4:
Console. WriteLine ("Thursday");
Break
Case 5:
Console. WriteLine ("Friday");
Break
Default
Console. WriteLine ("You may have entered incorrectly");
Break
Calculate the day ordinal of a year
Console.WriteLine ("Please enter the Year");
int year = Int. Parse (Console.ReadLine ());
Console.WriteLine ("Please enter the month");
int month = Int. Parse (Console.ReadLine ());
Console.WriteLine ("Please enter the day");
int day = Int. Parse (Console.ReadLine ());
int sum=0;
If ((year% 4 = = 0 && Year% 100! = 0) | | (year%400==0))
Switch (month)
{
Case 1:
Sum=day;
Break
Case 2:
Sum=31+day;
Break
Case 3:
..................
If statement and switch case