by BehindJava
Write a program to check whether the given year is a leap year or not
In this tutorial we are going to learn about writing a program to check whether the given year is a leap year or not.
Program to demonstrate whether the given year is aleap year or not
Explanation:
Leap year=A leap year is a year which is arthematically divided by 4 for years and the years whicha re ending with 00(Suppose 2000,3000…) and perfectly divided by 400.
year=2000
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))
else:
print("{0} is a leap year".format(year))
else:
print("{0} is not a leap year".format(year))