000010 IDENTIFICATION DIVISION.
000020 PROGRAM-ID. Aritmhatic.
000030 ENVIRONMENT DIVISION.
000040 DATA DIVISION.
000050 WORKING-STORAGE SECTION.
000060 01 DATA-SUMBER.
000061 02 NUM1 PIC 9 VALUE ZEROS.
000062 02 NUM2 PIC 9 VALUE ZEROS.
000063 02 NUM3 PIC 9 VALUE ZEROS.
000064 02 JUMLAH PIC 9 VALUE ZEROS.
000070 PROCEDURE DIVISION.
000080 MULAI.
000081 DISPLAY (1, 24)'OPERASI ARITMATIKA'.
000090 DISPLAY (2, 1)'ADD VERB'.
000091 DISPLAY (2, 38)'|'.
000100 DISPLAY (3, 1)'A : '. ACCEPT NUM1.
000110 DISPLAY (3, 10)'B : '. ACCEPT NUM2.
000120 DISPLAY (3, 19)'C : '. ACCEPT NUM3.
000121 DISPLAY (3, 38)'|'.
000130 ADD NUM1 TO NUM2.
000140 DISPLAY (4, 1)'(+) A TO B = ', NUM2, ' " <--- B = 3 "'.
000141 DISPLAY (4, 38)'|'.
000150 ADD NUM1, NUM2 TO NUM3.
000160 DISPLAY (5, 1)'(+) A, B TO C = ', NUM3.
000161 DISPLAY (5, 38)'|'.
000170 ADD NUM1, NUM2 GIVING JUMLAH.
000180 DISPLAY (6, 1)'(+) A, B GIVING D = ', JUMLAH.
000181 DISPLAY (6, 38)'|'.
000190 DISPLAY (2, 40)'SUBTRACT VERB'
000200 DISPLAY (3, 40)'A: '. ACCEPT NUM1.
000210 DISPLAY (3, 49)'B: '. ACCEPT NUM2.
000220 DISPLAY (3, 56)'C: '. ACCEPT NUM3.
000230 SUBTRACT NUM1 FROM NUM2.
000240 DISPLAY (4, 40)'(-) A FROM B = ', NUM2.
000250 SUBTRACT NUM1, NUM2 FROM NUM3.
000260 DISPLAY (5, 40)'(-) A, B FROM C = ', NUM3.
000270 SUBTRACT NUM1 FROM NUM2 GIVING JUMLAH.
000280 DISPLAY (6, 40)'(-) A FROM B GIVING D = ', JUMLAH.
000281 DISPLAY (7, 1)'-----------------------------------------------'
000282 DISPLAY (7, 47)'----------------------------'
000290 DISPLAY (8, 1)'DIVIDE VERB'.
000291 DISPLAY (8, 38)'|'.
000300 DISPLAY (9, 1)'A : '. ACCEPT NUM1.
000301 DISPLAY (9, 38)'|'.
000310 DISPLAY (9, 10)'B : '. ACCEPT NUM2.
000312 DISPLAY (10, 38)'|'.
000320 DIVIDE NUM1 INTO NUM2 GIVING JUMLAH REMAINDER NUM3.
000330 DISPLAY (11, 1)'(/) A INTO B GIVING C = ', JUMLAH, ' SISA = '
000332- , NUM3.
000331 DISPLAY (11, 38)'|'.
000340 DIVIDE NUM1 BY NUM2 GIVING JUMLAH REMAINDER NUM3.
000350 DISPLAY (12, 1)'(/) A BY B GIVING C = ', JUMLAH, ' SISA = '
000351- , NUM3.
000352 DISPLAY (12, 38)'|'.
000353 DIVIDE NUM1 INTO NUM2 GIVING JUMLAH.
000354 DISPLAY (13, 1)'(/) A INTO B GIVING C = ', JUMLAH.
000355 DISPLAY (13, 38)'|'.
000356 DIVIDE NUM1 INTO NUM2.
000357 DISPLAY (14, 1)'(/) A INTO B = ', NUM2.
000358 DISPLAY (14, 38)'|'.
000359 DIVIDE NUM1 BY NUM2 GIVING JUMLAH.
000360 DISPLAY (15, 1)'(/) A BY B GIVING C = ', JUMLAH.
000361 DISPLAY (15, 38)'|'.
000370 DISPLAY (8, 40)'COMPUTE'
000370 DISPLAY (9, 40)'A : '. ACCEPT NUM1.
000380 DISPLAY (9, 49)'B : '. ACCEPT NUM2.
000400 COMPUTE JUMLAH = NUM1 + NUM2.
000410 DISPLAY (11, 40)'A + B = ', JUMLAH.
000420 COMPUTE JUMLAH = NUM1 - NUM2.
000430 DISPLAY (12, 40)'A - B = ', JUMLAH.
000440 COMPUTE JUMLAH = NUM1 / NUM2.
000450 DISPLAY (13, 40)'A / B = ', JUMLAH.
000460 COMPUTE JUMLAH = NUM1 * NUM2.
000470 DISPLAY (14, 40)'A * B = ', JUMLAH.
000480 COMPUTE JUMLAH = NUM1 ** 2.
000490 DISPLAY (15, 40)'A PANGKAT 2 = ', JUMLAH.
000300 SELESAI.
000330 STOP RUN.
Output dari Program :
0 comments:
Post a Comment