请教问题
提干:从键盘输入年月日,计算该日是该年的第几天。
程序:
#include "stdio.h" main() { int year,month,days,i,leap,day; static int mtable[][13]={{0,31,28,31,30,31,30,31,31,30,31,30,31},{0,31,29,31,30,31,30,31,31,30,31,30,31}}; printf("\nInput year,month,day:"); scanf("%d,%d,%d",&year,&month,&day); leap=0; if(year%4==0&&year%100!=0||year%400==0) leap=1; days=day; for(i=1;i<month;i++) days+=mtable[leap][13]; printf("Days=%d",days); }
怎么运行结果不是很理想呢?请指教那里写错了!