using System; using System.Collections.Generic; public class MyClass { public static void Main() { Console.WriteLine("请输入长方形的长:"); int a=int.Parse(Console.ReadLine()); Console.WriteLine("请输入长方形的宽:"); int b=int.Parse(Console.ReadLine()); Console.WriteLine("长方形的面积为:{0}",a*b); Console.WriteLine("长方形的周长为:{0}",(a+b)*2); Console.ReadLine(); } }
using System; using System.Collections.Generic; public class MyClass { public static void Main() { Console.WriteLine("请输入日期:"); int year=int.Parse(Console.ReadLine()); if((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) { Console.WriteLine("为闰年"); } else { Console.WriteLine("不为闰年"); } Console.ReadLine(); } }
using System; using System.Collections.Generic; public class MyClass { public static void Main() { Console.WriteLine("请输入第1个数字:"); int a = int.Parse(Console.ReadLine()); Console.WriteLine("请输入第2个数字:"); int b = int.Parse(Console.ReadLine()); Console.WriteLine("请输入第3个数字:"); int c = int.Parse(Console.ReadLine()); int temp = 0; if(a > b) { temp = a; a = b ; b = temp; } if(a > c) { temp = a; a = c; c = temp; } if (b > c) { temp = b; b = c; c = temp; } Console.WriteLine("最大的数: {0}",c); Console.ReadLine(); } }