题目描述
使用C#编写一个控制台应用。输入-一个年份,判断是否润年(被4整除,且不被100整除,或者被400整除)。
是闰年输出yes,不是输出no
是闰年输出yes,不是输出no
输入
一个年份
输出
yes或者no
样例输入
1996
样例输出
yes
using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Helloworld { class Program { static void Main(string[] args) { int year = Convert.ToInt32(Console.ReadLine()); if ((year % 4 == 0) && (year % 100 != 0) || year % 400 == 0) { Console.WriteLine("yes"); } else { Console.WriteLine("no"); } Console.ReadKey(); } } }