Q. Write a program to take year as input and check if it is leap year or not.
You can understand by Watching video :-
Answer :-
year = int(input("Enter year = ")) print((year % 4 == 0 and "it is leap year ")or "it is not leap year")
Output :-
Enter year = 2020
it is leap year
>>>
Enter year = 2022
it is not leap year
>>>
Enter year = 2016
it is leap year
>>>
this leap year program is wrong
ReplyDeleteyear = int(input("Enter year = "))
if year % 400 = = 0:
A=True
elif year % 100 = = 0:
A=False
elif year % 4 == 0:
A=True
else:
A=False
if A= =True:
print("the ",year," is a leap year")
else:
print("the ",year," is not a leap year")
Post a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )