答案。
#include <stdio.h>
int main()
{
int nian;
int yue;
int ri;//年月日
int i=0;
printf("请输入年月日:");
scanf("%d %d %d",&nian,&yue,&ri);
switch(yue)
{
case 12:
i+=30;
case 11:
i+=31;
case 10:
i+=30;
case 9:
i+=31;
case 8:
i+=31;
case 7:
i+=30;
case 6:
i+=31;
case 5:
i+=30;
case 4:
i+=31;
case 3:
if((nian%400==0)||(nian%4==0&&nian%100!=0))
{
i+=29;
}
else
i+=28;
case 2:
i+=31;
case 1:
i+=ri;
break;
}
printf("该天是该年的第%d天\n",i);
return 0;
}