Task

Determine whether a given year is a leap year in the Gregorian calendar.



See also

 Leap year (wiki)


 
PROCEDURE IsLeapYear(year: INTEGER): BOOLEAN;
BEGIN
  IF year MOD 4 # 0 THEN 
    RETURN FALSE
  ELSE 
    IF year MOD 100 = 0 THEN
      IF year MOD 400  = 0 THEN
	RETURN TRUE
      ELSE 
	RETURN FALSE
      END
    ELSE
      RETURN TRUE
    END
 END
END IsLeapYear;
 