Leap Year

Practice this coding question on Coding Gurukul.

Problem statement

A digital archive generates calendars for historical and future years. Before adding a February 29 entry, it must apply the Gregorian leap-year rules. Your task Decide whether the given year y is a leap year under the Gregorian calendar. Important details A year divisible by 400 is a leap year. Otherwise, a year divisible by 100 is not a leap year. Of the remaining years, those divisible by 4 are leap years. Apply these rules to every input year using the proleptic Gregorian calendar, even before its historical adoption. Testing divisibility by 4 alone gives incorrect results for some century years. Worked example Year 2000 is divisible by 400, so print true. Year 1900 is divisible by 100 but not 400, so print false.

Input format

One integer y.

Output format

Print true for a leap year, otherwise false.

Constraints

1 <= y <= 10000.

Sample input

2000

Sample output

true

Sign in to run or submit a solution in C++, Java or Python.