# Leap Year Rules Recap:
# A year is a leap year if:
# It is divisible by 4 and not divisible by 100
# OR
# It is divisible by 400
# For example:
# 2000 → Leap year ✅ (divisible by 400)
# 1900 → Not a leap year ❌ (divisible by 100 but not 400)
# 2024 → Leap year ✅ (divisible by 4 and not 100)
#take input from user
year = int(input("Please enter the year: "))
if (year % 4 ==0 and year % 100 !=0) or (year % 400 == 0):
print(f"{year} is a leap year")
else:
print(f"{year} is not a leap year")
No comments:
Post a Comment