How to resolve the algorithm Leap year step by step in the RPG programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Leap year step by step in the RPG programming language

Table of Contents

Problem Statement

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

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Leap year step by step in the RPG programming language

Source code in the rpg programming language

     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

  

You may also check:How to resolve the algorithm Hello world/Text step by step in the MyDef programming language
You may also check:How to resolve the algorithm Terminal control/Preserve screen step by step in the Java programming language
You may also check:How to resolve the algorithm Exponentiation operator step by step in the Ela programming language
You may also check:How to resolve the algorithm Command-line arguments step by step in the Ursala programming language
You may also check:How to resolve the algorithm Pragmatic directives step by step in the PicoLisp programming language