main()
{
int year,month,f=0,s;
printf("请输入年和月:");
scanf("%d%d",&year,&month);
if((year % 4 == 0)&&(year % 100 != 0)||(year%400==0)) /*判断该年是否为闰年*/
f=1;
swicth(month)/*判断该月有多少天*/
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:s=31;break;
case 2:if(f==1) s=29;
else s=28;break;
default:s=30;
}
printf("该月有%d天",s);
}
{
int year,month,f=0,s;
printf("请输入年和月:");
scanf("%d%d",&year,&month);
if((year % 4 == 0)&&(year % 100 != 0)||(year%400==0)) /*判断该年是否为闰年*/
f=1;
swicth(month)/*判断该月有多少天*/
{
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:s=31;break;
case 2:if(f==1) s=29;
else s=28;break;
default:s=30;
}
printf("该月有%d天",s);
}