//比较运算符:
// > // < // == // >= // <= // !=
//逻辑运算符 与&& 或|| 非!
static void Main(string[] args) { while (true) { Console.WriteLine("请输入年份:"); int year = Convert.ToInt32(Console.ReadLine()); if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)) { Console.WriteLine("是闰年"); } else { Console.WriteLine("非闰年"); } Console.ReadKey(); } }
标签:逻辑,Console,&&,闰年,运算符,WriteLine,year,比较 From: https://www.cnblogs.com/csflyw/p/18352535