Python program to check leap year or not

https://www.itcomputerguruji.com/2021/04/python-program-to-check-leap-year-or-not.html

Write a program in python to check given year is leap year or not.

Leap Year- A year is evenly divisible by 4 is leap year. But it is not the only case. A year is a leap year, If it is divisible by 100, then it should also be divisible by 400

---------------------------------------------

Program :- 

year=int(input("Enter any year : "))

if year%4==0:

    if year%100==0:

        if year%400==0:

            print(year, "is a leap year")

        else:

            print(year, "is a not leap year")

    else:

            print(year, "is a leap year")

else:

            print(year, "is a not leap year")

---------------------------------------------

Output:-

Enter any year : 1990

1990, is a not leap year

---------------------------------------------

Enter any year : 2004

2004, is a leap year

Post a Comment

0 Comments