fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int month;
  5. char* day;
  6. printf("Please input a month number: ");
  7. scanf("%d",&month);
  8. switch(month){
  9. case 1:
  10. day = "31";
  11. break;
  12. case 2:
  13. day = "28/29";
  14. break;
  15. case 3:
  16. day = "31";
  17. break;
  18. case 4:
  19. day = "30";
  20. break;
  21. case 5:
  22. day = "31";
  23. break;
  24. case 6:
  25. day = "30";
  26. break;
  27. case 7:
  28. day = "31";
  29. break;
  30. case 8:
  31. day = "31";
  32. break;
  33. case 9:
  34. day = "30";
  35. break;
  36. case 10:
  37. day = "31";
  38. break;
  39. case 11:
  40. day = "30";
  41. break;
  42. case 12:
  43. day = "31";
  44. break;
  45. default:
  46. printf("Invalid input");
  47. }
  48. printf(day);
  49. return 0;
  50. }
  51.  
Success #stdin #stdout 0s 5284KB
stdin
3
stdout
Please input a month number: 31