#include<stdio.h>
#define N 12
int main()
{
int m,n;
do {
printf("Input year,month:");
scanf("%d,%d", &m, &n);
} while (n <1 || n > 12);
int days[2][N] = { {31,28,31,30,31,30,31,31,30,31,30,31},{31,29,31,30,31,30,31,31,30,31,30,31} };
if ((m % 4 == 0) && (m % 100 != 0) || (m % 400 == 0))
printf("The number of days is %d\n", days[1][n - 1]);
else
printf("The number of days is %d\n", days[0][n - 1]);
}
从键盘输入某年某月(包括闰年),编程输出该年的该月拥有的天数。**输入格式要求:“%d,%d“ 提示信息:“Input year,month:“ “The number of days is %d\
最新推荐文章于 2023-08-07 09:35:47 发布