#include<stdio.h> int main() { int v,sum; int leap(int year);//判断闰年 int add(int month1[],int month,int day);//算天数 int year,month,day; int month1[13]= {0,31,28,31,30,31,30,31,31,30,31,30,31}; scanf("%d%d%d",&year,&month,&day); if(year<=0&&month>0&&month<13&&day>0&&day<32) { v=leap(year); sum=add(month1,month,day); if(v==0) printf("是第%d天\n",sum); else printf("是第%d天\n",sum+1); } else printf("输入错误\n"); return 0; } int leap(int year) { int t=0; if(year%4==0&&year%100!=0||year%400==0) t=1; return t; } int add(int month1[],int month,int day) { int i,n=0; for(i=1; i<month; i++) { n=n+month1[i]; } n=n+day; return n; }