#include <stdio.h>
int main()
{
int year,mon,day,sum,p;
printf("年 月 日 :\n");
scanf("%d %d %d",&year,&mon,&day);
sum=tianshu(&mon,&day);
p=runnian(&year);
if(mon>=3&&p==1)
sum++;
printf("%d年%d月%d日是这一年的第%d天\n",year,mon,day,sum);
}
int runnian(int *y)
{
int s=0;
if(*y%4==0&&*y%400!=0||*y%100==0&&*y%400==0)
s=1;
return s;
}
int tianshu(int *m,int *d)
{
int s=0;
int i=0;
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
for( i=0;i<*m-1;i++) s=s+a[i];
s=s+*d;
return s;
}
12-29
1709
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)