Task

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



See also

 Leap year (wiki)


proc nonrec leap_year(word year) bool:
    year%400=0 or (year%4=0 and year%100/=0)
corp
 
proc nonrec main() void:
    [15]word years = (1899, 1900, 1901, 1902, 1903, 1904, 1905, 1999,
                      2000, 2001, 2002, 2003, 2004, 2021, 2022);
    word i;
 
    for i from 0 upto 14 do
        writeln(years[i],
                if leap_year(years[i]) then " is " else " is not " fi,
                "a leap year.")
    od
corp