c语言 输入该年月日,求是第几天
#include<stdio.h>int main()
{
int riqi(int,int,int);
int year,month,day,c;
printf("请输入年月日");
scanf("%d %d %d",&year,&month,&day);
c=riqi(year,month,day);
printf("%d\n",c);
return 0;
}
int riqi(int year,int month,int day)
{
int z=0;
int i;
int a[12]={31,28,31,30,31,30,31,31,30,31,30,31};
for(i=1;i<month;i++)
{
z=z+a[i];
}
if((year%4==0&&year%100!=0||year%400==0)&&month>=3)
z=z+1;
return z;
}
结果不对,帮我看看哪里不对啊