91学习

陪伴你每一天!

判断月份是大月还是小月份

#include <stdio.h>


int main(){

int iMonth=0,iDay=0;

printf("enter the month you want to know the days\n");

scanf("%d",&iMonth);

switch(iMonth){

case 1:

case 3:

case 5:

case 7:

case 8:

case 10:

case 12:

      iDay=31;

  break;

case 4:

case 6:

case 9:

case 11:

      iDay=30;

  break;

case 2:

iDay=28;

break;

default:

iDay=-1;

break;

}

if(iDay==-1){

printf("there is a error with your enter!\n");

}else{

printf("2019.%d has %d days\n",iMonth,iDay);

}

return 0;

}

加威信18790284560免费送POS机.jpg

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。