Program COBOL segitiga

Posted: Januari 10, 2011 in ALL NEWS

PROGRAM SEGITIGA

IDENTIFICATION DIVISION.

PROGRAM-ID.LOOP.

ENVIRONMENT DIVISION.

DATA DIVISION.

WORKING-STORAGE SECTION.

77 BIL PIC 9.

77 ANGKA PIC 9.

77 LOOP PIC 99.

SCREEN SECTION.

01 CLS.

02 BLANK SCREEN.

01 INPUTAN.

02 LINE 5 COLUMN 5 VALUE ‘MASUKKAN BILANGAN: ‘.

02 COLUMN PLUS 1 PIC 9 TO BIL.

PROCEDURE DIVISION.

MULAI.

DISPLAY CLS.

DISPLAY INPUTAN.

ACCEPT INPUTAN.

DISPLAY CLS.

COMPUTE ANGKA = 1.

COMPUTE COL = 1.

COMPUTE LOOP= 0.

COMPUTE BIL = BIL + 1.

PERFORM CETAK BIL TIMES.

STOP RUN.

CETAK.

PERFORM CETAK2 LOOP TIMES.

COMPUTE LOOP=LOOP + 1.

COMPUTE LIN=LIN + 1.

COMPUTE ANGKA= 1.

COMPUTE COL= 1.

CETAK2.

DISPLAY (LIN,COL)ANGKA.

COMPUTE COL = COL + 3.

COMPUTE ANGKA = ANGKA + 1.

OUTPUT

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s