/*******************************************************************************
isLeapYear(year: positive integer): boolean
Check whether a given year is a leap year.
Input
year Year to check (> 1581).
Returns TRUE when `year' is a leap year, FALSE if it is not.
Description In the Gregorian calendar a year is a leap year when it
is divisible by 4 and is not a turn of the century
exept when the turn of the century is in a year being
a multiple of 400. The Gregorian calendar was
introduced by pope Gregorius XIII in 1582. Source:
Winkler Prins Technische Encyclopedie.
*******************************************************************************/
int isLeapYear(unsigned int year)
{
assert(year > 1581);
return(((year % 4 == 0) && (year % 100)) || (year % 400 == 0));
}
***************************************************************************
int islyr (int year)
{
return((year % 400 == 0) || ((year % 100) && (year % 4 == 0)))
} /* islyr */
Rule 1: If the year is divisible by 400, it IS a leap year.
Rule 2: If the year is divisible by 100, it IS NOT a leap year.
Rule 3: If the year is divisible by 4, it IS a leap year.