Advertisement
albertoanggi

LA - Pertemuan 3

Oct 25th, 2017
3,533
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
COBOL 1.09 KB | None | 0 0
  1.     IDENTIFICATION DIVISION.
  2.     PROGRAM-ID. SEGITIGASIKU.
  3.     ENVIRONMENT DIVISION.
  4.     DATA DIVISION.
  5.     WORKING-STORAGE SECTION.
  6.     01 TINGGI PIC 99.
  7.     01 PARA PIC 99.
  8.     01 PARA2 PIC 99.
  9.     01 PARA3 PIC 99.
  10.     01 PARA4 PIC 99.
  11.     01 RMH PIC 99.
  12.     SCREEN SECTION.
  13.     01 HAPUS.
  14.         02 BLANK SCREEN.
  15.     PROCEDURE DIVISION.
  16.     MULAI.
  17.         DISPLAY HAPUS.
  18.         COMPUTE PARA = 1.
  19.         DISPLAY(, ) 'Masukan Tinggi : ' ACCEPT TINGGI.
  20.         COMPUTE PARA2 = TINGGI.
  21.         COMPUTE PARA3 = 2 * TINGGI .
  22.         COMPUTE PARA4 = PARA3 + 2.
  23.     MULAI2.
  24.         IF PARA2 NOT< 1
  25.             GO TO ULANG
  26.         ELSE
  27.             IF TINGGI NOT< 1
  28.                 GO TO BADAN
  29.             ELSE
  30.                 STOP RUN.
  31.     ULANG.
  32.         PERFORM SPASI PARA2 TIMES.
  33.         PERFORM BINTANG PARA TIMES.
  34.         PERFORM ATAP PARA3 TIMES.
  35.         DISPLAY SPACE.
  36.         COMPUTE PARA2 = PARA2 - 1.
  37.         COMPUTE PARA = PARA + 2.
  38.         GO TO MULAI2.
  39.     BINTANG.
  40.         DISPLAY(, ) '*'.
  41.     SPASI.
  42.         DISPLAY(, ) ' '.
  43.     ATAP.
  44.         DISPLAY(, ) '\_'.
  45.     BADAN.
  46.         COMPUTE RMH = PARA3 - 1.
  47.         PERFORM DEPAN PARA4 TIMES.
  48.         PERFORM BELAKANG RMH TIMES.
  49.         DISPLAY SPACE.
  50.         COMPUTE TINGGI = TINGGI - 1.
  51.         GO TO MULAI2.
  52.     DEPAN.
  53.         DISPLAY(, ) '#'.
  54.     BELAKANG.
  55.         DISPLAY(, ) '=='.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement