*PROGRAM TO FIND LARGEST OF 3 NUMBERS
IDENTIFICATION DIVISION
PROGRAM-ID. LARGEST OF 3 NUMBERS
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC S9999V99.
77 B PIC S9999V99.
77 C PIC S9999V99.
77 K PIC ZZ99.99.
PROCEDURE DIVISION.
EVAL-PARA.
DISPLAY "ENTER THE VALUES OF A B C".
ACCEPT A.
ACCEPT B.
ACCEPT C.
IF A = B AND B = C
DISPLAY "all are equal"
ELSE IF A > B AND A > C
MOVE A TO K
DISPLAY "LARGEST=", K GO TO EXT-PARA
ELSE IF B > C
MOVE B TO K
DISPLAY "LARGEST=", K GO TO EXT-PARA
ELSE
MOVE C TO K
DISPLAY "LARGEST=", K.
EXT-PARA.
STOP-RUN.
IDENTIFICATION DIVISION
PROGRAM-ID. LARGEST OF 3 NUMBERS
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC S9999V99.
77 B PIC S9999V99.
77 C PIC S9999V99.
77 K PIC ZZ99.99.
PROCEDURE DIVISION.
EVAL-PARA.
DISPLAY "ENTER THE VALUES OF A B C".
ACCEPT A.
ACCEPT B.
ACCEPT C.
IF A = B AND B = C
DISPLAY "all are equal"
ELSE IF A > B AND A > C
MOVE A TO K
DISPLAY "LARGEST=", K GO TO EXT-PARA
ELSE IF B > C
MOVE B TO K
DISPLAY "LARGEST=", K GO TO EXT-PARA
ELSE
MOVE C TO K
DISPLAY "LARGEST=", K.
EXT-PARA.
STOP-RUN.
No comments:
Post a Comment