判断是不是润年
1.能被4整除但不能被100整除
2.能被400整除
#include <stdio.h>
//打印1000-2000之间的润年
int main()
{
//判断是不是润年
//1.能被4整除但不能被100整除
//2.能被400整除
int y;
int count = 0;
for (y = 1000; y <= 2000; y++)
{
if (y % 4 == 0 && y % 100 != 0)
{
printf("%d ", y);
count++;
}
if (y % 400 == 0)
{
printf("%d ", y);
count++;
}
}
printf("\n%d\n", count);
return 0;
}