发布网友 发布时间:2022-04-23 05:26
共1个回答
热心网友 时间:2023-10-16 08:45
int DayoYear(int year,int month,int day)追答
#include "stdio.h"
int DayoYear(int year,int month,int day)
{int i,d,a[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
d=day;
if(year%4==0&year%100!=0||year%400==0)a[2]++;
for(i=1;i<month;i++)
d+=a[i];
return d;
}
int main()
{int y,m,d;
scanf("%d%d%d",&y,&m,&d);
printf("%d\n",DayoYear(y,m,d));
return 0;
}