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); } Console.ReadLine();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;d=a; Console.WriteLine(c); Console.WriteLine(d); Console.ReadLine();
3.> < >= <= == != (关系运算符)
Console.Write("请输入整数a:"); int a=int.Parse(Console.ReadLine()); Console.Write("请输入整数b:"); int b=int.Parse(Console.ReadLine()); bool c=a<b; Console.Write("c"); Console.ReadLine();
时间: 2024-11-08 16:25:31