今天是今年的第几天啊

#include
int leap(int year)
{
int leap;
leap=year%4==0&&year%100!=0||year%400==0;
return (leap);
}
int main()
{
int mon[]= {0,28,31,30,31,30,31,31,30,31,30};
int year,month,day;
scanf("%d%d%d",&year,&month,&day);
if(month>1)
mon[0]=31;
int i,t=0;
for(i=0; i t=t+mon[i];
t=t+day;
if(leap(year)&&month>2)
t=t+1;
printf("%d",t);
return 0;
}

转载于:https://www.cnblogs.com/SSYYGAM/p/4214025.html

你可能感兴趣的:(今天是今年的第几天啊)