39.9k views
5 votes
Write a program will print all of the leap years between 1900 and 2100, inclusive. Leap years are any year that is evenly divisible by 4 BUT years that are divisible by 4 and 500 are not leap years For example: the year 1000 is evenly divisible by 4 and 500, therefore it was not a leap year g

User Hanzi
by
4.8k points

1 Answer

6 votes

In python 3:

year = 1900

while year != 2100:

if year % 4 == 0 and year % 500 != 0:

print(year)

year += 1

User Abhay Saraf
by
5.0k points