← all problems

isLeapYear 🌶️🌶️

Write a method that takes one int parameter, year, and returns true if it is a leap year, or false otherwise. A year is a leap year if it is divisible by 4, UNLESS it is also divisible by 100 — in which case it is only a leap year if it is ALSO divisible by 400. (For example: 2024 is a leap year; 1900 is not, even though it is divisible by 4, because it is divisible by 100 but not 400; 2000 is a leap year, because it is divisible by 400.)