当前位置:网站首页><C>. Calculation date to day conversion
<C>. Calculation date to day conversion
2022-06-25 19:58:00 【Yuueki XY39】
#include<stdio.h>
int runyearpanduan(int x)
{
if ((x % 4 == 0 && x % 100 != 0) || (x % 400 == 0))
{
return 1; // Leap year
}
else
{
return 0;// Ordinary year
}
}
int main()
{
int year = 0;
int month = 0;
int days = 0;
int i = 0;
scanf("%d %d %d", &year,&month,&days);
int runyear = 0;
runyear = runyearpanduan(year);
int run[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
int ping[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
int sum = 0;
if (runyear == 1)
{
for (i = 0; i < month - 1; i++)
{
sum = sum + run[i];
}
sum = sum + days;
printf("%d", sum);
}
if (runyear == 0)
{
for (i = 0; i < month - 1; i++)
{
sum = sum + ping[i];
}
sum = sum + days;
printf("%d", sum);
}
return 0;
}
// Seamless switching of English Pinyin , Ha ha ha ha ha ha ha
边栏推荐
- Pat b1054 average (20 points)
- JS asynchronism (I. asynchronous concept, basic use of web worker)
- SEO outsourcing reliable company, enterprise SEO outsourcing company which reliable?
- PAT B1081
- Principles of MySQL clustered index and non clustered index
- Gbpnzd firm offer for 14 months, simulation for 19 months, test stable
- Vulnhub range - darkhole 1
- Redis cache preheating & avalanche & breakdown & penetration
- 3、 Hikaricp source code analysis of connection acquisition process III
- Est - il sûr d'ouvrir un compte avec de nouvelles dettes? Une faible Commission est - elle crédible?
猜你喜欢
Mail monitoring cloud script execution progress
On Oracle full stack virtual machine -- graalvm
Vulnhub range - correlation:2
Record Baidu search optimization thinking analysis
Huawei released two promotion plans to promote AI talent development and scientific research innovation
Process of vacuum and vacuum full
Suddenly found that the screen adjustment button can not be used and the brightness can not be adjusted
Vulnhub range - darkhole 1
What should I pay attention to in GoogleSEO content station optimization?
Use of serialize() and serializearray() methods for form data serialization
随机推荐
JS advanced
wooyun-2014-065513
PAT B1053
Embark on a new journey and reach the world with wisdom
From now on, I will blog my code
Applet wx Request encapsulation
DARKHOLE 2
JS asynchronism (I. asynchronous concept, basic use of web worker)
Number of wechat applet custom input boxes
JS mobile phone and computer open different websites
在打新债开户证券安全吗?低佣金靠谱吗
Server journey from scratch - Yu Zhongxian integrated version (IP access server, LNMP compilation and installation, Lua environment and socket expansion)
Is it safe to open an account with flush?
Thymleaf template configuration analysis
Google cloud SSH enable root password login
DataX script task development record
二、HikariCP獲取連接流程源碼分析二
Can the stock account opened through qiniu school be used? Is the fund safe?
Est - il sûr d'ouvrir un compte avec de nouvelles dettes? Une faible Commission est - elle crédible?
Yaml configuration