#include<stdio.h>标签:count,return,闰年,int,leap,2000,year,1000 From: https://blog.51cto.com/u_15923331/5983194
int is_leap_year(int n)
{
if ((n % 4 == 0 && n % 100 != 0) || (n % 400 == 0))
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int year = 1000;
int count = 0;
for (year = 1000; year <= 2000; year++)
{
int m =is_leap_year(year);
if (m == 1)
{
printf("%d ", year);
count++;
}
}
printf("\n 有%d个闰年", count);
return 0;
}