Berbagi ilmu : Contoh Program Atap Rumah Pada Bahasa Pemrograman
COBOL
LISTING
PROGRAM
IDENTIFICATION DIVISION.
PROGRAM-ID. Y.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 angka PIC 99.
01 awal PIC 99.
01 segi PIC 99.
SCREEN SECTION.
01 HAPUS.
02 BLANK SCREEN.
PROCEDURE DIVISION.
MULAI.
DISPLAY 'ATAP RUMAH'.
DISPLAY ' '.
DISPLAY ( , ) 'MASUKKAN ANGKA : '.
ACCEPT angka.
COMPUTE awal = 1.
COMPUTE segi = angka.
PROSES.
DISPLAY ' '.
PERFORM SPASI segi TIMES
PERFORM CETAK1 awal TIMES
PERFORM CETAK angka TIMES
IF awal = angka
PERFORM AKHIR
ELSE GO TO CEK.
AKHIR.
STOP RUN.
CEK.
COMPUTE awal = awal + 1.
COMPUTE segi = segi - 1.
GO TO PROSES.
SPASI.
DISPLAY ( , ) ' '.
CETAK.
DISPLAY ( , ) '* '.
CETAK1.
DISPLAY ( , ) '/ '.
OUTPUT
PROGRAM
EmoticonEmoticon