当年第几天
来源:互联网 发布:qq群优化排名 编辑:程序博客网 时间:2024/06/09 17:46
#include<stdio.h>int days(int y, int m, int d);int main(){ int year, month, day; printf("输入年 月 日: "); scanf("%d %d %d", &year, &month, &day); printf("这是该年的第 %d 天\n", days(year, month, day)); return 0;}int days(int y, int m, int d){ int sum=d; //加上前m-1月的天数 int i; for(i=1; i<m; i++) { if(i==1||i==3||i==5||i==7||i==8||i==10||i==12) sum+=31; else if (i==4||i==6||i==9||i==11) sum+=30; else sum+=((y%4==0&&y%100!=0)||y%400==0)?29:28; } return sum;}
0 0
- 当年第几天
- 当年第几天?
- 当年第几天
- 计算当年第几天
- 当年第几天
- 当年第几天
- 当年第几天
- 当年第几天
- 当年第几天?
- 当年第几天
- 当年第几天
- 第十二周-当年第几天
- 某年某月某天是当年第几天
- 当年第几天(极简版)
- WV.46-当年第几天
- 第十二周项目一 当年第几天
- 第十二周项目1-当年第几天
- 当年第几天(数集)
- 第九周项目2-对称矩阵压缩存储的实现与应用(2)
- 函数指针
- SQL SERVER 10048
- JPA实体继承实体的映射策略
- 第十周项目1---二叉树算法库
- 当年第几天
- 第十周上机实践—项目3—利用二叉遍历思想解决问题
- 第九周项目2 - 对称矩阵压缩存储的实现与应用(2)
- Spring学习笔记(三)
- 第十周项目3--利用二叉树遍历思想解决问题(2)
- Table打印 根据高度自动分页
- 第四周项目5-循环双链表应用
- 第9章项目4 广义表的算法库及应用(2)
- 第十周 项目3-5 判断二叉树是否相似