当前位置:网站首页>计算一年中第几天,C语言实现
计算一年中第几天,C语言实现
2022-04-21 12:46:00 【大今野】
计算一年中第几天,C语言实现
#include <stdio.h>
int isleap(int year)
{
int leap;
leap = (year % 4 == 0 && year % 100 != 0 || year % 400 == 0);
return leap;
}
int fun(int year, int month, int day)
{
int table[13] = {
0,31,28,31,30,31,30,31,31,30,31,30,31 };
int days = 0, i;
for ( i = 1; i < month; i++)
{
days = days + table[i];
}
days = days + day;
if (isleap(year)&&month>2)
{
days = days + 1;
return days;
}
}
main()
{
int year, month, day, days;
printf("请输入年、月、日:");
scanf_s("%d%d%d", &year, &day, &days);
days = fun(year, month, day);
printf("%d年%d月%d日是该年的第%d天\n", year, month, day, days);
}
代码之余
“我是河流中较大的那块石头
把眼泪分成均匀的两份
一份流淌着父亲
一份流淌着母亲。”
隐仙 弃却千万厦,了尘归天涯。
袅袅青烟起,飘飘云升霞。
笑谈竹篱短,醉卧夕阳下。
惊觉皓月影,提壶自还家。
足轻踏草去,重观落英花。
难辨此中意,欲语还言罢。
后来还写了许多诗写过一些词,
闲日浮生奢念,偷戏雀风琳苑。
峙语笑翩连,兀自不觉缘浅。
初见,初见,满眼柳折莺咽。
版权声明
本文为[大今野]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_45755863/article/details/124312582
边栏推荐
- 第四章 SQL查询之-层次化查询
- AcWing 1854. Equation Derivation for solving promotion counting problem
- 上个网课都能被AI分析“在走神”,英特尔这个情绪检测AI火了
- SKU中的销售属性值必须成对填写,那这是什么原因
- 数据显示ETH燃烧的有多猛
- 2020BATJZ大厂Android高级工程师面试题-选择题合集(附答案解析)
- Office Word 2016 中Word自带公式编辑器编辑的公式转Mathtype出现omml2mml.xsl 问题的解决方法
- Package rpart of decision regression tree implemented by R language
- 伯克利、三星|一个快速的训练后变换器修剪框架
- R语言中实现随机森林建模的包randomForest
猜你喜欢
随机推荐
爱可可AI前沿推介 (4.21)
open-mmlab / mmpose安装、使用教程
【无标题】
如何免费的使用思维导图和流程图制作(Draw.io VS 代码集成)
Who does the team listen to
C语言嵌套练习
Game industry case 2: player level
selenium的滑块验证码的模拟登录(猪八戒网站)
制造业数字化转型存在哪些问题
2022年一级注册建筑师考试建筑物理与设备复习题及答案
The small program rotates the mobile phone to push the stream, and the remote pull stream picture is cut
高并发IO的底层原理
How to choose the production company of product 3D display film?
Anchor-free新网络:CenterNet携手CornerNet形成了CenterNet++
Scala installation and development environment configuration tutorial
Introduction notes to PHP zero Foundation (11): String
分享几款我在高频使用的 Chrome 浏览器插件,每一个都好用到飞起
ASM插桩之美
DeFi借贷VS传统金融“无风险”利率产品
Three.js学习项目--3D抗美援朝数据可视化








