In this post, we will write a Python program to check whether the input year(entered by user) is leap year or not.
Python Code
In this program, user is asked to enter a year. Program checks whether the entered year is leap year or not.
# User enters the year
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")
Output:
No comments:
Post a Comment
Your feedback is highly appreciated and will help us to improve our content.