Flow controls: Conditions · 17 / 22 Exercise Easy

Leap year

Objective

A year is a leap year if it is divisible by 4, except century years (divisible by 100), which are only leap years if they are also divisible by 400. It is a good example of compound conditions with and, or and parentheses.

Instructions

  • Read a year (integer).
  • Show year: is a leap year if it is a leap year or year: is not a leap year if it is not.
Input
2024
Output
2024: is a leap year

Open the editor in full screen: the statement on the left and your code, the output and the tests on the right.

Start exercise