用Visual Studio判断闰年和非闰年
1、打开Visual Studio,选择新建项目。

2、点击Visual C#,选择右边的控制应用台。

3、代码
int year;
for (int i = 0; i < 6; i++)
{
Console.Write("请输入年份: ");
year = int.Parse(Console.ReadLine());
if (year % 4 == 0)
{
if (year % 100 == 0)
{
if (year % 400 == 0)
Console.WriteLine("{0}年是闰年! ", year);
else
Console.WriteLine("{0}年不是闰年! ", year);
}
else
{
Console.WriteLine("{0}年是闰年! ", year);
}
}
else
{
Console.WriteLine("{0}年不是闰年! ", year);
}
Console.ReadLine();
