Write a program to check whether a input year is leap year in python
Answers
Answered by
31
Answer:
year = int(input("Enter Year: "))
# Leap Year Check
if year % 4 == 0 and year % 100 != 0:
print(year, "is a Leap Year")
elif year % 100 == 0:
print(year, "is not a Leap Year")
elif year % 400 ==0:
print(year, "is a Leap Year")
else:
print(year, "is not a Leap Year")
Answered by
1
Answer:
Python Program to Check Leap Year
- If a year is evenly divisible by 4 means having no remainder then go to next step. If it is not divisible by 4. It is not a leap year. ...
- If a year is divisible by 4, but not by 100. For example: 2012, it is a leap year. ...
- If a year is divisible by 100, but not by 400. For example: 1900, then it is not a leap year.
Similar questions