|
¹Ú¿ì¹üÀÇ Çã¶ô ¾øÀÌ´Â »ó¾÷Àû »ç¿ëÀ» ±ÝÇÕ´Ï´Ù. |
[Example 2] |
[ 1 + 2 + 3 + ¡¦¡¦ + 99 + 100 ]ÀÇ °á°ú¸¦ Ç¥½ÃÇÏ´Â ÇÁ·Î±×·¥À» ÀÛ¼ºÇϽÿÀ. |
0 *
1 2
3 4
5 6
7
123456*89012345678901234567890123456789012345678901234567890123456789012 * 01 IDENTIFICATION DIVISION. 02 PROGRAM-ID. SAMPLE2. 03 *-------------------------------------* 04 ENVIRONMENT DIVISION. 05 CONFIGURATION SECTION. 06 SOURCE-COMPUTER. SAMSUNG. 07 OBJECT-COMPUTER. SAMSUNG. 08 *-------------------------------------* 09 DATA DIVISION. 10 WORKING-STORAGE SECTION. 11 77 T PIC 9(5) VALUE 0. 12 77 I PIC 9(3). 13 *-------------------------------------* 14 PROCEDURE DIVISION. 15 ADD1-RTN. 16 ADD 1 TO I. 17 ADD I TO T. 18 IF I < 100 GO TO ADD1-RTN. 19 DISPLAY "SUM1 = " T. 20 ADD2-RTN. 21 MOVE 0 TO I T. 22 PERFORM ADD-RTN VARYING I FROM 1 BY 1 UNTIL I > 100. 23 DISPLAY "SUM2 = " T. 24 MOVE 0 TO I T. 25 ADD3-RTN. 26 COMPUTE I = I + 1. 27 COMPUTE T = T + I. 28 IF I < 100 GO TO ADD3-RTN. 29 DISPLAY "SUM3 = " T. 30 END-RTN. 31 STOP RUN. 32 ADD-RTN. 33 ADD I TO T. |
|
¢Ð | ¢½ | ¢Ñ |