请大家帮忙看下哪有问题,输出结果不正确!!
#include<stdio.h>main(){
int i,week=0,m,y,md=0,yd=0,day=0;
printf("请输入年份和月份:");
scanf("%d %d",&y,&m);
for(i=1990;i<y;i++){
if(y%4==0 && y%100!=0 || y%400==0){
yd+=366;
}else
yd+=365;
}
for(i=1;i<m;i++){
switch(i){
case 2:
if(y%4==0 && y%100!=0 || y%400==0){
md+=29;
}else
md+=28;break;
case 4: case 6: case 9: case 11:
md+=30;break;
default :
md+=31;
}
}
week=(yd+md)%7;
printf("一\t二\t三\t四\t五\t六\t日\n");
for(i=1;i<=week;i++){
printf("\t");
}
switch(m){
case 2:
if(y%4==0 && y%100!=0 || y%400==0){
day=29;
}else
day=28;break;
case 4: case 6: case 9: case 11:
day=30;break;
default :
day=31;
}
for(i=1;i<=day;i++){
printf("%d\t",i);
if((week+i)%7==0){
printf("\n");
}
}
}
这个程序是打印所输入月份的月历,但是输出结果有时正确有时错误,请大家帮忙看下哪有问题 谢谢!!