输出1900-2000年中是闰年的年份,符合下面两个条件之一的年份是闰年

输出1900-2000年中是闰年的年份,符合下面两个条件之一的年份是闰年

1.能被4整除但不能被100整除。

2.能被100整除且不能被400整除。

 1 #include<stdio.h>
 2 int main()
 3 {
 4     int year;
 5     for(year=1900;year<=2000;year++)
 6     {
 7         if(year%4==0&&year%100!=0)
 8         {
 9             printf("1900-2000中闰年有:%d\n",year);
10         }
11         if(year%100==0&&year%400!=0)
12         {
13             printf("1900-2000中闰年有:%d\n",year);
14         }
15     }
16     return 0;
17 }

 

posted @ 2021-03-15 09:47  醉月8848  阅读(1650)  评论(0)    收藏  举报