#include <stdio.h>
int main(int argc, char const *argv[])
{
int day, month, year;
int s=0;
scanf("%d %d %d", &year, &month, &day);
switch (month)
{
case 12:
s +=30;
case 11:
s +=31;
case 10:
s +=30;
case 9:
s +=31;
case 8:
s +=31;
case 7:
s +=30;
case 6:
s +=31;
case 5:
s +=31;
case 4:
s +=31;
case 3:
s +=28;
case 2:
s +=31;
case 1:
s+=day;break;
}
if ((year%4==0&&year%100!=0||year%400==0)&&month>2)
{
s++;
printf("今年是润年,今天是今年的第:%d\n",s);
}
else
{
printf("今年是平年,今天是今年的第:%d天\n",s);
}
return 0;
}
C语言(2)闰年平年判断
最新推荐文章于 2024-07-23 22:06:37 发布