CameraIcon
CameraIcon
SearchIcon
MyQuestionIcon
MyQuestionIcon
1
You visited us 1 times! Enjoying our articles? Unlock Full Access!
Question

Write a program to check if the year entered by the user is a leap year or not.

Open in App
Solution

The year is a leap year if it is divisible by 4.

Program:
year = int(input("Enter the year: "))
if(year % 4 == 0):
print("The year",year," is a leap year.")
else:
print("The year",year," is not a leap year.")


OUTPUT:
Enter the year: 2020
The year 2020 is a leap year.

flag
Suggest Corrections
thumbs-up
25
Join BYJU'S Learning Program
similar_icon
Related Videos
thumbnail
lock
One Year
MATHEMATICS
Watch in App
Join BYJU'S Learning Program
CrossIcon