Most years have 52 weeks, some have 53, according to ISO8601.



Task

Write a function which determines if a given year is long (53 weeks) or not, and demonstrate it.




BYTE FUNC P(CARD y)
RETURN ((y+(y/4)-(y/100)+(y/400)) MOD 7)
 
BYTE FUNC IsLongYear(CARD y)
  IF P(y)=4 OR P(y-1)=3 THEN
    RETURN (1)
  FI
RETURN (0)
 
PROC Main()
  CARD y
  BYTE LMARGIN=$52,oldLMARGIN
 
  oldLMARGIN=LMARGIN
  LMARGIN=0 ;remove left margin on the screen
  Put(125) PutE() ;clear the screen
 
  FOR y=1900 TO 2400
  DO
    IF IsLongYear(y) THEN
      PrintC(y) Put(32)
    FI
  OD
 
  LMARGIN=oldLMARGIN ;restore left margin on the screen
RETURN