Skip to main content

Practice ยท 2 of 5

Leap year, precisely specified

Implement boolean isLeapYear(int year). The full rule: divisible by 4 โ†’ leap, EXCEPT centuries โ€” divisible by 100 is NOT leap unless also divisible by 400. So 2000 was leap, 1900 was not, 2024 is.

Difficulty: beginner

Back to lesson: Practice: Practice: Decisions