Rating: 4.5
Reviewer: Unknown
ItemReviewed: Turbo Pascal: Looping Piramid
Looping Piramid
Gambar: Turbo Pascal, Looping Piramid |
Contoh1: Looping Piramid For To Do hingga 20
uses wincrt;
var kolom,baris,ulang:integer;
begin
for baris:=1 to 20 do
begin
for kolom:=1 to baris do
begin
write('*');
end;
writeln;
end;
end.
Hasil:
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************
***************
****************
*****************
******************
*******************
********************
Contoh2: Looping Piramid For To Do 20, tiap 5x
uses wincrt;
var kolom,baris,ulang:integer;
begin
for baris:=1 to 20 do
begin
for kolom:=1 to baris do
begin
write('*');
end;
if baris mod 5=0 then
begin
readln;
end;
writeln;
end;
end.
Hasil:
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
*************
**************
***************
****************
*****************
******************
*******************
********************