Question: Write a program using switch statements that will read the number of a month and will print the number of days in the month. Include

Write a program using switch statements that will read the number of a month and will print the number of days in the month. Include a for-loop that will ask the user to enter four different month numbers. The program must meet the following criteria:

1. Comment statement with your name in the program and for each line of code.

2. Program uses switch statements and not if statements.

3. Be efficient. You can create the program with only four sets of case statements (28 days, 30 days, 31 days, or invalid month entered)

4. Set a variable called DAY to the number of days in the month selected.

5. Print the variable DAY as part of your program along with the month number entered. Do not simply have a statement that prints "Your month has 30 days."

6. If the user enters a value not 1-12, the program must print a message about this not being a month.

7. Use a for-loop to make the program ask the user to enter a month four times.

I am using C code with the Geany software.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!