Program to print addition of two numbers and print if summation is equal to third number or not.
IDENTIFICATION DIVISION. PROGRAM-ID. ASS2. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL SELECT OUT2 ASSIGN TO DISK ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD OUT2 LABEL RECORDS ARE STANDARD VALUE OF FILE-ID IS "OUT2.TXT". 01 OUT-REC. 05 MSG-OUT PIC X(30). WORKING-STORAGE SECTION. 77 NO1 PIC 9(2) VALUE IS 10. 77 NO2 PIC 9(2) VALUE IS 20. 77 NO3 PIC 9(2) VALUE IS 30. 77 ANS PIC 9(3). PROCEDURE DIVISION. MAIN-PARA. OPEN OUTPUT OUT2. COMPUTE ANS = NO1 + NO2. IF ANS = NO3 DISPLAY "no1 + no2 = no3" MOVE 'no1 + no2 = no3.' TO MSG-OUT ELSE DISPLAY "no1 + no2 <> no3" MOVE 'no1 + no2 <> no3' TO MSG-OUT. WRITE OUT-REC. CLOSE OUT2. STOP RUN. Input:- 100100200 Output:- no1 + no2 = no3.