fork download
  1. //課題023
  2. //数字を入力して、その数の月の名前を英語で表示するプログラムです
  3. // 2026.06.17 24A2021 伊藤宗兼
  4. #include <stdio.h>
  5.  
  6. int main(void) {
  7. int number;
  8.  
  9. printf("1~12の数字を入力してください。\n");
  10. scanf("%d", &number);
  11. switch (number) {
  12. case 1: printf("その数字の月は英語で January です。");
  13. break;
  14. case 2: printf("その数字の月は英語で February です。");
  15. break;
  16. case 3: printf("その数字の月は英語で March です。");
  17. break;
  18. case 4: printf("その数字の月は英語で April です。");
  19. break;
  20. case 5: printf("その数字の月は英語で May です。");
  21. break;
  22. case 6: printf("その数字の月は英語で June です。");
  23. break;
  24. case 7: printf("その数字の月は英語で July です。");
  25. break;
  26. case 8: printf("その数字の月は英語で August です。");
  27. break;
  28. case 9: printf("その数字の月は英語で September です。");
  29. break;
  30. case 10: printf("その数字の月は英語で October です。");
  31. break;
  32. case 11: printf("その数字の月は英語で November です。");
  33. break;
  34. case 12: printf("その数字の月は英語で December です。");
  35. break;
  36. default: printf("そんな月はありません!");
  37. break;
  38. }
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0s 5316KB
stdin
12
stdout
1~12の数字を入力してください。
その数字の月は英語で December です。