#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int is_leap(int year)
{
if (((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0))
{
return 1;
}
return 0;
}
int main()
{
int year = 0;
for (year = 1000; year <= 2000; year++)
{
if (is_leap(year))
{
printf("%d ", year);
}
}
return 0;
}
用函数判断year是不是闰年
最新推荐文章于 2023-07-10 14:39:54 发布