CJCoding With Joseph
15free / daySign inCreate account

Days in a Month

Two variables are given: month (1 to 12) and year. Print Days: <n> where n is the number of days in that month. April, June, September and November have 30 days; February has 28, or 29 in a leap year (divisible by 4 but not by 100, unless divisible by 400); every other month has 31. Use || to group the 30-day months and nest the leap-year test inside the February branch.

Expected Output:

Days: 29

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
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 (clog, fn, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.