Minggu, 29 Oktober 2017

Program Segitiga Siku-Siku dengan COBOL

       IDENTIFICATION DIVISION.
       PROGRAM-ID. SS.
       AUTHOR. FOST.
       ENVIRONMENT DIVISION.
       DATA DIVISION.
       WORKING-STORAGE SECTION.     
       01 seg.
         02 A PIC 9(3).
         02 I PIC 9(3).
                     02 J PIC 9(3).
      
       PROCEDURE DIVISION.
       MULAI.
         DISPLAY  '============================'.
         DISPLAY  'Masukan Angka Pertama  : '.
         ACCEPT A.
       PROSES.
                     PERFORM CETAK VARYING I FROM 1 BY 1
                     UNTIL I > A
                     AFTER J FROM 1 BY 1
                     UNTIL J > I.
                     GO TO SEL.
       CETAK.
                     DISPLAY ( , ) '*'.
                     IF J = I DISPLAY SPACE.
       SEL.
                     STOP RUN.

Tidak ada komentar:

Posting Komentar