输出某天是这一年的第几天?
#include<stdio.h>
int fun(int year)
{
int n=0;
if(((year%4==0)&&(year%100!=0))||(year%400==0))
{
n=1;
}
return n;
}
int main()
{
int year,month,day;
int sum,i;
while(~scanf("%d %d %d",&year,&month,&day))
{
sum=0;
int a[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31};
int b[13]= {0,31,29,31,30,31,30,31,31,30,31,30,31};
for(i=0; i<month; i++)
{
if(fun(year)==0)
{
sum+=a[i];
}
else if(fun(year)==1)
{
sum+=b[i];
}
}
sum+=day;
printf("%d\n",sum);
}
return 0;
}