/* Note:Your choice is C IDE */
#include "stdio.h"
void main()
{int sum_day(int,int);
int leap(int year);
int year,month,day,days;
printf("input date(year,month,day):");
scanf("%d,%d,%d",&year,&month,&day);
printf("%d/%d/%d/",year,month,day);
days=sum_day(month,day);
if(leap(year)&&month>=3)
days=days+1;
printf("is the %dth day in this year.\n",days);
printf("2013304143\n");
}
int sum_day(int month,int day)
{int day_tab[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int i;
for (i=1;i
day+=day_tab[i];
return(day);
}
int leap(int year)
{int leap;
leap=year%4==0&&year%100!=0||year%400==0;
return(leap);
}
总结:C程序内容比较多,而且容易出错,很考验人的眼力以及脑力,在程序输入的时候一定要细心。还有在敲代码的时候,思路一定要清晰,逻辑要好。程序运行出现问题时,要耐心多调试几次