add numbers and store in multiple data name

Program to ADD more than two numbers and to store in multiple data name

IDENTIFICATION DIVISION.
PROGRAM-ID. PGM12.
AUTHOR. XYZ.
*ADD MORE THAN TWO NUMBERS STORE IN MULTI DATA NAME
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC 9(2) VALUE 12.
77 B PIC 9(2) VALUE 12.
77 C PIC 9(2) VALUE 12.
77 D PIC 9(2) VALUE 12.
77 E PIC 9(2) VALUE ZERO.
77 F PIC 9(2) VALUE ZERO.
PROCEDURE DIVISION.

ADD A B C D GIVING E F.
DISPLAY 'E = A + B + C +D ' E.
DISPLAY 'F = A + B + C +D ' F.
STOP RUN.

0 comments:

Post a Comment