C语言添加一句判断是否闰年的语句 输出某年某月的天数#includevoid main (){ int year,month,days; printf("please enter year and month:\n"); scanf("%d,%d",&year,&month); switch(month) {case 2:----------------------------------------
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/23 14:43:17
C语言添加一句判断是否闰年的语句 输出某年某月的天数#includevoid main (){ int year,month,days; printf("please enter year and month:\n"); scanf("%d,%d",&year,&month); switch(month) {case 2:----------------------------------------
C语言添加一句判断是否闰年的语句 输出某年某月的天数
#include
void main ()
{
int year,month,days;
printf("please enter year and month:\n");
scanf("%d,%d",&year,&month);
switch(month)
{case 2:
-----------------------------------------------------------
days=29;
else
days=28;
break;
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:days=31;
case 4:
case 6:
case 9:
case 11:days=30;
printf("days=%d",days);
}
在线求解啊 各位高手 菜鸟
在线等
C语言添加一句判断是否闰年的语句 输出某年某月的天数#includevoid main (){ int year,month,days; printf("please enter year and month:\n"); scanf("%d,%d",&year,&month); switch(month) {case 2:----------------------------------------
判断闰年的语句:if((year%4==0&&year%100!=0)||(yaer%400=0))
leap=1;
else leap=0;
leap=1表示是闰年,=0表示不是闰年.