#include<stdio.h>
int main()
{
int year, month;
printf("输入年和月(用空格分隔):\n"); scanf_s("%d %d", &year, &month);
switch (month)
{
case 2:
if (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0))
printf("29天!\n");
else
printf("28天!\n"); break;
case 4:
case 6:
case 9:
case 11: printf("30天!\n"); break;
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12: printf("31天!\n"); break;
default:printf("错误的月份!!!\n"); break;
}
return 0;
}
【C熟肉】输入年月输出天数
最新推荐文章于 2024-04-15 17:07:27 发布