โ Back to If Statements
Question 266
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
Topics:
If Statements
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท 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.