#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int leap_year(int a) //判断是否为闰年的函数,如果是那么久返回1,如果不是那么就返回0
{
if (a % 100 == 0)
{
if (a % 400 == 0)
return 1;
else
return 0;
}
else if (a % 4 == 0)
{
if (a % 100 != 0)
return 1;
}
else
return 0;
}
int main()
{
int y = 0; int judge = 0;
for(y=1000;y<=2000;y++) //经典的for循环来逐个判断1000~2000
{
judge = leap_year(y); //赋予判断值
if (judge == 1)
printf("%d ", y);
else
;
}
return 0;
}