算术运算符+ - * / % ++ --
举例:1.
while (true)
{
Console.Write("请输入整数a:");
int a = int.Parse(Console.ReadLine());
Console.Write("请输入整数b:");
int b = int.Parse(Console.ReadLine());
int c = a + b;
Console.Write("加法结果是:" + c);
c = a - b;
Console.Write("减法结果是:" + c);
c = a * b;
Console.Write("乘法结果是:" + c);
c = a / b;
Console.Write("除法结果是:" + c);
c = a % b;
Console.Write("取余数结果是:" + c);
}
2.
Console.Write("请输入整数a:");
int a = int.Parse(Console.ReadLine());
Console.Write("请输入整数b:");
int b = int.Parse(Console.ReadLine());
int c =a++;// int c=a;a=a+1;
int d =++a;//a=a+1;int d=a;
Console.WriteLine(c);
Console.WriteLine(d);
比较运算符> < >= <= != ==
Console.Write("请输入整数a:");
int a = int.Parse(Console.ReadLine());
Console.Write("请输入整数b:");
int b = int.Parse(Console.ReadLine());
bool c = a > b;
Console.WriteLine(c);
Console.ReadLine();
逻辑运算符&& || !
Console.Write("请输入整数a:");
int a = int.Parse(Console.ReadLine());
Console.Write("请输入整数b:");
int b = int.Parse(Console.ReadLine());
c=15;
bool L= a > b||a>c&&b>c;
Console.WriteLine(L);
Console.ReadLine();
条件运算符 ?:
int c = 1 > 2 ? 5 : 6; //如果1>2成立,那么返回5,否则就返回6
Console.Write(c);
Console.ReadLine();
赋值运算符 = += -= *= /= %=
优先级:
前++ ——
* / %
+-
> < >= <= == !=
&& || !
自己瞎整理的,有些马虎