#include<stdio.h>
main()
{ int month,years;
printf("请输入年月:");
scanf("%d",&years),scanf("%d",&month);
//for(i=1;i<=12;i++)为什么错了
if(years%400==0)
printf("the month is 29 days");
else if(month==2)//必须加这个条件限制
printf("the month is 28 days");
switch(month)
{case 1:printf("the month is 31 days");break;
// case 2:printf("the month is 28 days");break;
case 3:printf("the month is 31 days");break;
case 4:printf("the month is 30 days");break;
case 5:printf("the month is 31 days");break;
case 6:printf("the month is 30 days");break;
case 7:printf("the month is 31 days");break;
case 8:printf("the month is 31 days");break;
case 9:printf("the month is 30 days");break;
case 10:printf("the month is 31 days");break;
case 11:printf("the month is 30 days");break;
case 12:printf("the month is 31 days");break;
}
}
相关文章: