Task

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



See also

 Leap year (wiki)


PROGRAM LEAP_YEAR
 
FUNCTION LEAP(YR%)
     LEAP=(YR% MOD 4=0) AND ((YR% MOD 400=0) OR (YR% MOD 100<>0))
END FUNCTION
 
BEGIN
     LOOP
        INPUT("Enter a year: ",year%)
        EXIT IF YEAR%=0
        IF LEAP(year%) THEN
            PRINT(year%;" is a leap year")
          ELSE
            PRINT(year%;" is not a leap year")
        END IF
     END LOOP
END PROGRAM