//本题注意闰年这个特例
#include <stdio.h>
#define m 12
int main()
{
int days[2][m]={{31,28,31,30,31,30,31,31,30,31,30,31},
{31,29,31,30,31,30,31,31,30,31,30,31}};
int month ,years;
do
{
scanf("%d%d",&years,&month);
}while(month<1||month>12);
if(((years%4==0)&&years/100!=0)||years%400==0)
printf("%d\n",days[1][month-1]);
else
printf("%d\n",days[0][month-1]);
return 0;
}
输入一个年份和一个月份,输出这月有多少天
最新推荐文章于 2024-07-08 08:25:44 发布