← Back to If Statements
Question 236
Leap Year Rule
Leap Year Rule
Read a year and print Leap year or Not a leap year. A year is a leap year when it is divisible by 4 but not by 100, or when it is divisible by 400, so 2024 and 2000 are leap years and 1900 is not. Use the remainder operator % to test divisibility and combine the three tests with and, or and parentheses. Input: one integer, the year, no prompt. Output: one line.
Expected Output:
Leap year= newline. The output ends with a newline — print one after the last line.
Hints3 available
Sign in to use hintsTopics:
If StatementsOperators
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.