#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
int a = 30;
int b = 31;
int sum , f;
switch(month)
{
case 1:sum=0;
break;
case 2:sum=b;
break;
case 3:sum=a+b;
brake;
case 4:sum=a+2*b;
break;
case 5:sum=2*a+2*b;
break;
case 6:sum=2*a+3*b;
break;
case 7:sum=3*a+3*b;
break;
case 8:sum=3*a+4*b;
break;
case 9:sum=3*a+5*b;
break;
case 10:sum=4*a+5*b;
break;
case 11:sum=4*a+6*b;
break;
case 12:sum=5*a+6*b;
break;
default;
printf("一年只有12个月哦~");
break:
}
if(year%4==0&&year%100!=0||year%400==0)
f=1;
else
f=2;
if(month>2)
sum=sum+day-f;
else
sum+=day;
printf("%d年%d月%d日是该年的第%d天。",year,month,day,sum);
return 0;
}