RosettaCodeData/Task/Long-year/Commodore-BASIC/long-year-2.basic

14 lines
344 B
Plaintext

function p(y as unsigned integer) as unsigned integer
return ( y + int(y/4) - int(y/100) + int(y/400) ) mod 7
end function
function islongyear( y as uinteger ) as boolean
if p(y) = 4 then return true
if p(y-1) = 3 then return true
return false
end function
print islongyear(1998)
print islongyear(2020)
print islongyear(2021)