|
|
|
|
|
|
|
|
|
|
* |
|
|
IDENTIFICATION |
|
DIVISION. |
|
|
PROGRAM-ID. |
|
T1. |
|
* |
|
|
ENVIRONMENT |
|
DIVISION. |
|
|
CONFIGURATION |
|
SECTION. |
|
|
SOURCE-COMPUTER. |
|
SAMSUNG. |
|
|
OBJECT-COMPUTER. |
|
SAMSUNG. |
|
* |
|
|
DATA |
|
DIVISION. |
|
|
WORKING-STORAGE |
|
SECTION. |
|
* |
|
|
77 |
T |
PIC |
9(5) |
VALUE 0. |
|
|
77 |
I |
PIC |
9(3). |
|
|
|
* |
|
|
PROCEDURE |
|
DIVISION. |
|
|
ADD1-RTN. |
|
|
|
|
|
|
|
ADD 1 TO I. |
|
|
|
ADD I TO T. |
|
|
|
IF I < 100 GO
TO ADD1-RTN. |
|
|
|
DISPLAY "SUM1 = " T. |
|
|
ADD2-RTN. |
|
|
|
|
|
|
|
MOVE 0 TO I T. |
|
|
|
PERFORM ADD-RTN |
|
|
|
|
VARYING I FROM 1
BY 1 UNTIL I > 100. |
|
|
|
DISPLAY "SUM2 = " T. |
|
|
|
MOVE 0 TO I T. |
|
|
ADD3-RTN. |
|
|
|
|
|
|
|
COMPUTE I = I +
1. |
|
|
|
COMPUTE T = T +
I. |
|
|
|
IF I < 100 GO
TO ADD3-RTN. |
|
|
|
DISPLAY "SUM3 = " T. |
|
|
END-RTN. |
|
|
|
|
|
|
|
STOP RUN. |
|
|
ADD-RTN. |
|
|
|
|
|
|
|
ADD I TO T. |
|
|
|
|
|
|
|
|
|
|