Relational operators:> < >= <= and = = (equals)! = (Not equal)
Logical operator:&& (with) | | (OR)! (non, highest priority)
Assignment operator: = + = = *=/=%= Example: X-=4 is x=x-4
Conditional operator:? A:b if it is true to execute a, otherwise execute B
For a few examples:
A multiple of ①7, 10 digits is 7, the single digit is the number of 7
Console.WriteLine ("Please enter the number within 100");
int a = Int. Parse (Console.ReadLine ());
Console.WriteLine (a% 7 = = 0); The number that is divisible by 7
Console.WriteLine (A/10 = = 7);//10 digits is 7
Console.WriteLine (A%10 = = 7);//single digit is 7
Console.readkey ();
Ii
Console.WriteLine ("Please enter 2 Chinese characters");
String a1,a2;
A1 = Console.ReadLine ();
A2 = Console.ReadLine ();
Console.WriteLine (a1 = = "Hello");
Console.WriteLine (a1 = = "Hello" && a2 = = "Classmate");
Console.WriteLine (a1 = = "Hello" | | a2 = = "Classmate");
Console.WriteLine (! ( A1 = = "Hello" && a2 = = "Classmate");
Console.readkey ();
③
Console.WriteLine ("Please enter 2 values within 10 and add equals 15");
int b2 = Int. Parse (Console.ReadLine ());
int B3 = Convert.ToInt32 (Console.ReadLine ());
Console.WriteLine (B2 + b3 ==15?) "Answer right": "Answer the wrong, drag out the castrate!" ");
Console.readkey ();
④
Standard Weight:
Men's weight-height +100=±3; women's weight-height +110=±3;
String XB;
Double TZ, SG;
Console.WriteLine ("Judging whether a person's weight is a standard weight");
Console.Write ("Gender:");
XB = Console.ReadLine ();
Console.Write ("Weight (kg):");
TZ = Double. Parse (Console.ReadLine ());
Console.Write ("Height (cm):");
sg = convert.todouble (Console.ReadLine ());
int y = XB = = "Male"? 100:110;
Console.WriteLine (tz-sg+y<-3? ") Too skinny ":(tz-sg+y<=3)?" Perfect ":" Too fat ");
Console.readkey ();
⑤
int B = 1, c = 1, d = 1, E = 1, f = 1;
B + = 3;
c-= 3;
D *= 3;
e/= 3;
F%= 3;
Console.WriteLine (B.tostring ());
Console.WriteLine (C.tostring ());
Console.WriteLine (D.tostring ());
Console.WriteLine (E.tostring ());
Console.WriteLine (F.tostring ());
Console.readkey ();
C # Syntax Basics (relationships, logic, conditions, assignment operators)