#include <stdio.h>
#define MONTHS 12


int main()
{
    int days[MONTHS]={31,28,31,30,31,30,31,31,30,31,30,30};
    int month;
    do{
        printf("input a month:");
        scanf("%d",&month);
    }while(month<1||month>12);
    printf("the number of days is %d\n",days[month-1]);
    return 0;

}月份天数的对应

知识点;数组

心得体会:逗号不能丢

相关文章:

  • 2021-09-11
  • 2021-09-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2021-06-10
  • 2021-07-31
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-02-05
  • 2021-07-29
  • 2022-12-23
  • 2021-10-07
  • 2022-12-23
相关资源
相似解决方案