Write a program that asks for a starting year and an ending year and then puts all the leap years between them (and including them, if they are also leap years). Leap years are years divisible by 4 (like 1984 and 2004). However, years divisible by 100 are not leap years (such as 1800 and 1900) unless they are also divisible by 400 (such as 1600 and 2000, which were in fact leap years). What a mess!
The Answer to the Question
is below this banner.
Can't find a solution anywhere?
NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?
Get the Answers Now!You will get a detailed answer to your question or assignment in the shortest time possible.
Here's the Solution to this Question
Solution in Python Programming Language
start_year = int(input("Enter a start year: "))
end_year = int(input("Enter a end year: "))
for year in xrange(start_year, end_year + 4):
if (year % 4) == 0:
if (year % 100) == 0:
if (year % 400) == 0:
print year," is a leap year"
else:
print year," is a leap year"
If you would like to see a different solution or an implementation in a different programming language Kindly let us know