RosettaCodeData/Task/Leap-year/CLU/leap-year.clu
2023-07-01 13:44:08 -04:00

16 lines
573 B
Text

is_leap_year = proc (year: int) returns (bool)
return(year//400 =0 cor (year//4 = 0 cand year//100 ~= 0))
end is_leap_year
start_up = proc ()
po: stream := stream$primary_output()
years: sequence[int] := sequence[int]$
[1899, 1900, 1901, 1902, 1903, 1904, 1905, 1999,
2000, 2001, 2002, 2003, 2004, 2021, 2022]
for year: int in sequence[int]$elements(years) do
stream$puts(po, int$unparse(year) || " is ")
if ~is_leap_year(year) then stream$puts(po, "not ") end
stream$putl(po, "a leap year.")
end
end start_up