in

Cobol is literally just English

Cobol is literally just English

IDENTIFICATION DIVISION.

PROGRAM-ID. ADD_NUMBERS.

DATA DIVISION.

FILE SECTION.

WORKING-STORAGE SECTION.

01

FIRST-NUMBER

PICTURE

IS 99.

01

SECOND-NUMBER

PICTURE

IS 99.

01

RESULT

PICTURE

IS 9999.

PROCEDURE DIVISION.

MAIN-PROCEDURE.

DISPLAY “Here is the first Number “

MOVE 8 TO FIRST-NUMBER DISPLAY FIRST-NUMBER

DISPLAY “Let’s add 20 to that number.”

ADD 20 TO FIRST-NUMBER DISPLAY FIRST-NUMBER

DISPLAY “Create a second variable”

MOVE 30 TO SECOND-NUMBER

DISPLAY SECOND-NUMBER

*COMMENT: COMPUTE THE TWO NUMBER AND PLACE INTO RESULT*

COMPUTE RESULT = FIRST-NUMBER + SECOND-NUMBER.

DISPLAY “The result is:”.

DISPLAY RESULT.

STOP RUN.

END PROGRAM ADD_NUMBERS.

What do you think?

Leave a Reply

Your email address will not be published. Required fields are marked *

GIPHY App Key not set. Please check settings