#include int main(int argc, const char* argv[])
{
int i= 0;
int year= 0;
int count = 0;
for(year = 1;
year <= 2020;
year ++)
{
if(((!(year % 4)) && (year % 100)) || (!(year % 400)))
{
printf("%6d", year);
if(!( ++ i % 10 ))
putchar(10);
count++;
} }
putchar(10);
printf("count=%d\n", count);
return 0;
}
测试结果 【C实现测试距今年的闰年数目】
![C实现测试距今年的闰年数目](https://img.it610.com/image/info8/67efc1fc37d64b15bb82dcb823bb3510.jpg)
文章图片