C语言基础 判断1000到2000年有多个闰年
#include<stdio.h>
int main(){
int y=0;
int count=0;
for(y=1000;y<2000;y++)
{
if((y%4==0 && y%100!=0)|| y%400==0)
{
printf("%d是闰年\n",y);
count++;
}
}
printf("20世纪闰年共有%d年\n",count);
return 0;
}
...
原创
2020-11-20 08:13:33 ·
191 阅读 ·
0 评论