fork download
  1. #include <stdio.h>
  2. int main(void){
  3. int a;
  4. printf("1以上12以下の整数を入力して下さい");
  5. scanf("%d",&a);
  6. switch(a)
  7. {
  8.  
  9. case 1:
  10. case 3:
  11. case 5:
  12. case 7:
  13. case 8:
  14. case 10:
  15. case 12:
  16. printf("日数は31日");
  17. break;
  18.  
  19. case 4:
  20. case 6:
  21. case 9:
  22. case 11:
  23. printf("日数は30日");
  24. break;
  25. case 2:
  26. printf("日数は28日");
  27. break;
  28.  
  29. default:
  30. printf("1~12の整数を入力してください");
  31. break;
  32. }
  33. return 0;
  34.  
  35.  
  36. }
Success #stdin #stdout 0s 5320KB
stdin
3
stdout
1以上12以下の整数を入力して下さい日数は31日