← Back to If Statements
Question 336
Days in a Month
Days in a Month
Read a month number from1to12withscanfand print how many days it has (treat February as28, ignoring leap years). Print just the number with no trailing newline. February (2) has28. April, June, September, and November (4,6,9,11) have30. Every other month has31. For input2the output is28; for4it is30; for1it is31.
Expected Output:
28= newline. No newline after the last line.
Hints4 available
Sign in to use hintsTopics:
If Statements
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.