fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int mon;
  5.  
  6. printf("何月ですか?");
  7. scanf("%d", &mon);
  8.  
  9. switch(mon)
  10. {
  11. case 1:
  12. case 3:
  13. case 5:
  14. case 7:
  15. case 8:
  16. case 10:
  17. case 12:
  18. printf("31日です。\n");
  19. break;
  20.  
  21. case 4:
  22. case 6:
  23. case 9:
  24. case 11:
  25. printf("30日です。\n");
  26. break;
  27.  
  28. case 2:
  29. printf("28日です。\n");
  30. break;
  31.  
  32. default :
  33. printf("入力が無効です。1 -12を入力してください。\n");}
  34. return 0;
  35. }
  36.  
Success #stdin #stdout 0.01s 5256KB
stdin
Standard input is empty
stdout
何月ですか?入力が無効です。1 -12を入力してください。