#include<stdio.h>
int main()
{
int year,month,day,sum,a;
printf(“请输入年月日:”);
scanf("%d %d %d",&year,&month,&day);
if((year%40&&year%100!=0)||year%4000)
{
if(month1)
a=day;
if(month2)
a=day+31;
if(month3)
a=day+60;
if(month4)
a=day+91;
if(month5)
a=day+121;
if(month6)
a=day+152;
if(month7)
a=day+182;
if(month8)
a=day+213;
if(month9)
a=day+244;
if(month10)
a=day+274;
if(month11)
a=day+305;
if(month12)
a=day+335;
}
else
{
if(month1)
a=day;
if(month2)
a=day+31;
if(month3)
a=day+59;
if(month4)
a=day+90;
if(month5)
a=day+120;
if(month6)
a=day+151;
if(month7)
a=day+181;
if(month8)
a=day+212;
if(month9)
a=day+243;
if(month10)
a=day+273;
if(month11)
a=day+304;
if(month12)
a=day+334;
}
printf(“这一天是%d年的第%d天\n”,year,a);
return 0;
}
计算某年某月是本年度的第几天
最新推荐文章于 2022-09-07 20:02:27 发布