C++ Program: [Switch] Number of Days in a Month

By: Prof. Dr. Fazal Rehman Shamil | Last updated: July 25, 2024

Write a C++ program to print Number of Days in a Month.

 

Possible Outputs

Output #1

Enter the month number (1-12): 5
Number of days in month 5 is 31

Output #2

Enter the month number (1-12): 6
Number of days in month 6 is 30

Output #3

Enter the month number (1-12): 2
Number of days in month 2 is 28

Output #4

Enter the month number (1-12): 13
Invalid month number. Please enter a number between 1 and 12.