Skip to content

Latest commit

 

History

History
19 lines (14 loc) · 631 Bytes

README.md

File metadata and controls

19 lines (14 loc) · 631 Bytes

leap-year

Instructions

Implement a method that checks if a year is a leap year.

All the following rules must be satisfied:

  • A year is not a leap year if not divisible by 4
  • A year is a leap year if divisible by 4
  • A year is a leap year if divisible by 400
  • A year is not a leap year if divisible by 100 but not by 400

Examples:

  • 1997 is not a leap year (not divisible by 4)
  • 1996 is a leap year (divisible by 4)
  • 1600 is a leap year (divisible by 400)
  • 1800 is not a leap year (divisible by 4, divisible by 100, NOT divisible by 400)

The method should return true if a year is a leap year, and false if it is not.