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. printf("/n");
  9. switch(month){
  10. case 1:
  11. day = "31";
  12. break;
  13. case 2:
  14. day = "28/29";
  15. break;
  16. case 3:
  17. day = "31";
  18. break;
  19. case 4:
  20. day = "30";
  21. break;
  22. case 5:
  23. day = "31";
  24. break;
  25. case 6:
  26. day = "30";
  27. break;
  28. case 7:
  29. day = "31";
  30. break;
  31. case 8:
  32. day = "31";
  33. break;
  34. case 9:
  35. day = "30";
  36. break;
  37. case 10:
  38. day = "31";
  39. break;
  40. case 11:
  41. day = "30";
  42. break;
  43. case 12:
  44. day = "31";
  45. break;
  46. default:
  47. printf("Invalid input");
  48. }
  49. printf(day);
  50. return 0;
  51. }
  52.  
Success #stdin #stdout 0.01s 5284KB
stdin
3
stdout
Please input a month number: /n31