#include <stdio.h>
int main()
{
/* 定义需要计算的日期 */
int year = 2008;
int month = 8;
int day = 8;
int num ;
if(year/400 == 0 && year/100 != 0 || year/4 == 0)
{
day+=29;
}
else
{
day+=28;
}
for(month=1 ; month<=8; month++)
{
switch(month)
{
case 1:
case 3:
case 5:
case 7:
case 8:
num+=31;
break;
default:
num+=30;
break;
}
num=num+day-30+8;
}
printf("2008年8月8号是该年的第%d天", num);
return 0;
}
闰年表达式就错了,