Leap year
In the Gregorian calendar a year is a leap year when it is divisible by 4, except years divisible by 100, which are leap years only when they are also divisible by 400. So 2024 and 2000 are leap years, and 1900 and 2023 are not.
Read a year and print Yes if it is a leap year, No if it is not.
Input
One line with the year year.
Output
Yes or No.
Constraints
- 1 ≤
year≤ 9999
The input is read for you. The starter code puts it in variables; write your code under Your code here and print the answer. Changed the code already? Reset () brings the starter back.
Example 1
Input
2024
Output
Yes
Why:
2024 is divisible by 4 and not by 100.
Example 2
Input
1900
Output
No
Why:
1900 is divisible by 100 but not by 400.
Example 3
Input
2000
Output
Yes
Why:
2000 is divisible by 400.
Hints
Was this a good challenge?
- Solved by
- 1
- Submissions
- 1
- Accepted
- 100%