C#判断
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace 课堂 { class Program { static void Main(string[] args) { /* //变量的定义 int num; //string st; //通过键盘任意输入一个数的说明 Console.WriteLine("请输入一个整数"); num = Convert.ToInt32(Console.ReadLine()); //st = num % 2 == 0 ? "偶数" : "奇数"; //Console.WriteLine("这个数是" + st); if(num%2==0) { Console.WriteLine("偶数"); } else { Console.WriteLine("奇数"); } double s; Console.WriteLine("请输入成绩"); s = Convert.ToDouble(Console.ReadLine()); if (s > 90) { Console.WriteLine("师父说:奖励一本武功秘籍"); }*/ { //a能被b整除,a+b>100。则输出a int a, b; Console.WriteLine("请输入任意两个整数"); a = Convert.ToInt32(Console.ReadLine()); b = Convert.ToInt32(Console.ReadLine()); if ((a + b > 1000) || (a % b == 0)) Console.WriteLine(a); else Console.WriteLine(b); } { //任意输入两个数求最大值 double c, d; Console.WriteLine("请输入任意两个数"); c = Convert.ToDouble(Console.ReadLine()); d = Convert.ToDouble(Console.ReadLine()); if (c > d) Console.WriteLine("输出的值是" + c); else Console.WriteLine("输出的值是" + d); } { //比较两个数大小,要求x>y double x, y, l; Console.WriteLine("请输入x的值"); x = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入y的值"); y = Convert.ToDouble(Console.ReadLine()); if (x < y) { l = x; x = y; y = l; } Console.WriteLine("x的值是:" + x + ",y的值是:" + y); } /* { double t, g, n, y, h, s; Console.WriteLine("请输入t的值"); t = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入g的值"); g = Convert.ToDouble(Console.ReadLine()); Console.WriteLine("请输入n的值"); n = Convert.ToDouble(Console.ReadLine()); if((t>g)&&(g>n)) Console.WriteLine("t的值是:" + t + ",g的值是:" + g+",n的值是:" + n); else if((t > g) && (n>g)) { s = n; n = g; g = s; Console.WriteLine("t的值是:" + t + ",g的值是:" + g + ",n的值是:" + n); } if ((t < g) && (g > n)) t = g; y = g; t = y; Console.WriteLine("t的值是:" + t + ",g的值是:" + g + ",n的值是:" + n);*/ } } }
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构