Programming
Assignment #3: Defining a function for finding leap years
The task:
Define a function isLeapYear(number) that will return TRUE
or FALSE accordingly based on whether number
represents a leap year. Then in your program set up a loop to repeatedly call isLeapYear(x) to check every year x in the range of 1900 to 2400 to see whether
it is a leap year and print it out if it is indeed a leap year. In other words,
we want to define the isLeapYear and
then call it repeatedly to help us print out all the leap years in the range of
1900 to 2400.
Leap years:
A year is a leap year if it
is divisible by 4 except that any year divisible by 100 is a leap year only
if it is also divisible by 400. So 1900 is not a leap year, but 2000 is. In
other words,
·
a year (e.g. 1996) is a leap year if it is divisible by 4 but not by
100,