(一)题目要求
从键盘输入一个年份,判断是否为闰年。如果是闰年输出“yes”,否则输出”no”.
输入
1996
1998
输出
yes
no
(二)代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
int year = int.Parse(Console.ReadLine());
if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
{
Console.WriteLine("yes");
}
else
Console.WriteLine("no");
///Console.ReadKey();
}
}
}