Task

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



See also

 Leap year (wiki)


sub leapyear(year)
    if mod(year, 4) <> 0 then return false : fi
    if mod(year, 100) = 0 and mod(year, 400) <> 0 then return false : fi
    return TRUE
end sub
 
for year = 1800 to 2900 step 100
    print year; 
	if leapyear(year) then print " is a leap year" else print " is not a leap year" : fi
next year
 
print
 
for year = 2012 to 2031
    print year;
    if leapyear(year) = TRUE then print " = leap"; else print " = no"; : fi
    if mod(year, 4) = 3 then print : fi
next year
end