0% found this document useful (0 votes)
81 views3 pages

Pascal:: Contoh-Contoh Penggunaan Perulangan For..Do.

The document provides examples of using the For..Do loop in Pascal programming language. It shows 6 examples of For..Do loops that output triangular patterns by iterating through rows and columns. The examples demonstrate how to control the loop direction and output different values or characters in each iteration to create the patterns.

Uploaded by

Linda Isnaini
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views3 pages

Pascal:: Contoh-Contoh Penggunaan Perulangan For..Do.

The document provides examples of using the For..Do loop in Pascal programming language. It shows 6 examples of For..Do loops that output triangular patterns by iterating through rows and columns. The examples demonstrate how to control the loop direction and output different values or characters in each iteration to create the patterns.

Uploaded by

Linda Isnaini
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Pascal :: Contoh-Contoh Penggunaan Perulangan For..Do..

Posted by wira on May 21st, 2010 Berikut ini adalah sebagian contoh perulangan dengan penerapan statemen For.. Do..
Uses Wincrt; const akhir = 4; var baris,kolom : integer; begin for baris := akhir downto 1 do begin for kolom := baris downto 1 do write(kolom); writeln; end; end. Hasil : 4321 321 21 1

Uses Wincrt; const akhir = 4; var baris,kolom : integer; begin for baris := akhir downto 1 do begin for kolom := 1 to baris do write(kolom); writeln; end; end. Hasil : 1234 123 12 1

Uses Wincrt; const

akhir = 4; var baris,kolom : integer; begin for baris := 1 to akhir do begin for kolom := 1 to baris do write(baris); writeln; end; end. Hasil : 1 22 333 4444

Uses Wincrt; const akhir = 4; var baris,kolom : integer; begin for baris := akhir downto 1 do begin for kolom := baris downto 1 do write(baris); writeln; end; end. Hasil : 4444 333 22 1

Uses Wincrt; const akhir = 3; var baris,kolom : integer; begin for baris := akhir downto 1 do begin for kolom := baris downto 1 do write(baris,' ',kolom); writeln; end; end.

Hasil : 3 33 23 1 2 22 1 1 1

Uses wincrt; var baris,kolom,jumbaris :integer; begin write ('Jumlah Baris : ');readln(jumbaris); FOR BARIS:=1 TO jumbaris do begin write ('*': jumbaris baris); FOR kolom := 2 TO (2 *baris -1 ) do begin write('*'); end; writeln; end; end. Hasil : (baris = 4) * *** ***** *******

You might also like