class Program
{
static void Main(string[] args)
{
Console.WriteLine("请输入要判断的年份");
bool b= IsYear(Convert.ToInt32(Console.ReadLine()));
if (b)
{
Console.WriteLine("是闰年");
}
else
{
Console.WriteLine("不是闰年");
}
Console.ReadKey();
}
/// <summary>
/// 判断是否闰年
/// </summary>
/// <param name="year">要判断的年份</param>
/// <returns>是否是闰年</returns>
public static bool IsYear(int year)
{
bool b = (year % 400 == 0) || (year % 4 == 0 && year % 100 != 0);
return b;
}