给出年月日,求是一年中第几天,实在想不出问题处在哪?请大家帮忙?
#include"stdio.h"#include"math.h"
void main()
{
int year,month,day,days,leap,i;
int a[2][13]={(0,31,28,31,30,31,30,31,31,30,31,30,31),(0,31,29,31,30,31,30,31,31,30,31,30,31)};
scanf("%d,%d,%d",&year,&month,&day);
leap=0;
if(year%4==0&&year%100!=0||year%400==0)
{
leap=1;
}
days=day;
for(i=1;i<month;i++)
{
days+=a[leap][i];
}
printf("第%d天\n",days);
}