如何求闰年
来源:互联网 发布:mac版word怎么看字数 编辑:程序博客网 时间:2024/06/10 13:11
闰年是公历中的名词,能被4整除但不能被100整除,或能被400整除的年份即为闰年。
输入两个年份,输出这两个年份区间中的闰年。
#include <stdio.h>#include <string.h>#include <stdlib.h>#include <iostream>#include <algorithm>using namespace std;int f(int year){ if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) return 1; return 0;}int main(){ int y1,y2; cin >> y1 >> y2; for (int i = y1; i <= y2; ++i) { if(f(i)) printf("%d ",i); } return 0;}
阅读全文
0 0
- 如何求闰年
- 求闰年
- 求闰年
- 求闰年
- 求闰年
- 求闰年
- 求闰年
- 求闰年
- 求闰年
- 求闰年
- 求闰年
- C语言如何求闰年,打印输出1000-2000年之间的所有闰年.
- 求闰年小程序
- java 求闰年
- 汇编-求闰年
- 蓝桥杯 求闰年
- 求闰年的!!!
- 求闰年公式
- express4的router对象与app实例的用法
- 在路上
- android 二维码扫描 支持横竖屏切换Demo
- Linux下mysql的root密码忘记解决方法(三种)
- JavaScript寄生组合继承
- 如何求闰年
- c++基础(14)
- OpenCV-利用CV_MAT_ELEM宏和CV_MAT_ELEM_PTR宏存取CVMat数组元素
- 欢迎使用CSDN-markdown编辑器
- 手把手教你在Windows10下安装Tensorflow1.2
- 程力集团网址大全
- leetcode--18. 4Sum
- POJ 3264 Balanced Lineup
- ros如何及时清除障碍物层或者超声波层的的消息 clear_costmap_recovery 代码详解