Task

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



See also

 Leap year (wiki)


     C*0N01N02N03Factor1+++OpcdeFactor2+++ResultLenDHHiLoEqComments+++++++
     C           *ENTRY    PLIST
     C                     PARM           YEAR    40       input (year)
     C                     PARM           ISLEAP  1        output (Y/N)
     C*
     C                     MOVE 'N'       ISLEAP
     C           YEAR      CABLE1752      DONE             not Gregorian
     C*
     C           YEAR      DIV  4         RESULT  40
     C                     MVR            REMAIN  40
     C           REMAIN    CABNE0         DONE
     C*
     C* If we got here, year is divisible by 4.
     C           YEAR      DIV  100       RESULT
     C                     MVR            REMAIN
     C           REMAIN    CABNE0         LEAPYR
     C*
     C* If we got here, year is divisible by 100.
     C           YEAR      DIV  400       RESULT
     C                     MVR            REMAIN
     C           REMAIN    CABNE0         DONE
     C*
     C           LEAPYR    TAG
     C                     MOVE 'Y'       ISLEAP
     C*
     C           DONE      TAG
     C                     SETON                     LR