首页 >> 知识精选 >

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

2023-03-05 12:00:14 来源: 用户: 

大家好,小讯来为大家解答以上的问题。闰年的计算方法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.。

本文到此分享完毕,希望对大家有所帮助。

  免责声明:本文由用户上传,与本网站立场无关。财经信息仅供读者参考,并不构成投资建议。投资者据此操作,风险自担。 如有侵权请联系删除!

 
分享:
最新文章