您的位置首页 >生活百科 >

闰年怎么算c语言(闰年的计算方法c语言)

导读 今天凤捷来为大家解答以上的问题。闰年怎么算c语言,闰年的计算方法c语言相信很多小伙伴还不知道,现在让我们一起来看看吧!1、#include  ...

今天凤捷来为大家解答以上的问题。闰年怎么算c语言,闰年的计算方法c语言相信很多小伙伴还不知道,现在让我们一起来看看吧!

1、#include    int main(int argc, char **argv) {      int startY = 0;      int endY   = 0;      int i      = 0;      printf("Please Input start and end year [a,b]: ");      scanf("%d,%d", &startY, &endY);        if (endY < startY) {          printf("Input error.");          return -1;      }        if (endY < 0 || startY < 0) {          printf("Input  Error.");          return  -1;      }          for (i = startY; i <= endY; i++) {          if ((0 == i % 4 && 0 != i % 100) ||                  (0 == i % 100 && 0 == i % 400))          {              printf("the [%d] is Leap year.", i);          }      }      return 0;  } // 输出 ase Input start and end year [a,b]: 2000,2016the [2000] is Leap year.the [2004] is Leap year.the [2008] is Leap year.the [2012] is Leap year.the [2016] is Leap year.。

今天为大家分享到这里,希望小伙伴们会有帮助。

标签:

免责声明:本文由用户上传,如有侵权请联系删除!