fork(1) download
  1. #include <stdio.h>
  2. #define months 12
  3. int main(void)
  4. {
  5.  
  6. int days[months]={31,28,31,30,31,30,31,31,31,30,31,30,31};
  7. int n;
  8. do{
  9. scanf("%d",&n);
  10. }
  11.  
  12. while(n<1||n>12);
  13. printf("第%d个月的天数为%d",n,days[n-1]);
  14. return 0;
  15. }
Success #stdin #stdout 0s 544KB
stdin
3
stdout
第3个月的天数为31