Perintah FOR – Pascal


Program Pascal dengan menggunakan perintah FOR :

————————————————
Program ulang_01;
uses crt;

var
i : integer;

begin
clrscr;
writeln(‘menampilkan * diulang 10x horizontal’);
for i:= 1 to 10 do
write(‘*’);

writeln(”);
writeln(‘Menampilkan * diulang 10x vertikal’);
for i:=1 to 10 do
writeln(‘*’);

end.

————————————————

Program ulang_02;
uses crt;

var
i,j : integer;

begin
clrscr;
writeln(‘Menampilkan * diulang 10x horizontal dan 10x vertikal’);

for i:= 1 to 10 do
begin
for j:=1 to 10 do
write(‘*’);
writeln(”);
end;
end.

————————————————

Program ulang_03;
uses crt;

var
i,j : integer;

begin
clrscr;
writeln(‘Menampilkan * diulang 10x horizontal dan 10x vertikal’);

for i:= 1 to 10 do
begin
for j:=1 to i do
write(‘*’);
writeln(”);
end;
end.

————————————————

Program ulang_04;
uses crt;

var
i,j : integer;

begin
clrscr;
writeln(‘Menampilkan * diulang 10x horizontal dan 10x vertikal’);

for i:= 1 to 10 do
begin
for j:=1 to 11-i do
write(‘*’);
writeln(”);
end;
end.

————————————————

Program ulang_05;
uses crt;

var
i,j,k : integer;

begin
clrscr;
writeln(‘Menampilkan * diulang 10x horizontal dan 10x vertikal’);

for i:= 1 to 10 do
begin
for j:= 1 to i-1 do
write(‘ ‘);
for k:=1 to 11-i do
write(‘*’);
writeln(”);
end;
end.

————————————————

Program ulang_06;
uses crt;

var
i,j,k : integer;

begin
clrscr;
writeln(‘Menampilkan * diulang 10x horizontal dan 10x vertikal’);

for i:= 1 to 10 do
begin
for j:= 1 to 10-i do
write(‘ ‘);
for k:=1 to i do
write(‘*’);
writeln(”);
end;
end.

————————————————

Program ulang_07;
uses crt;

var
i,j,k : integer;

begin
clrscr;
writeln(‘Menampilkan * diulang 10x horizontal dan 10x vertikal’);

for i:= 1 to 10 do
begin
for j:= 1 to 10-i do
write(‘ ‘);
for k:=1 to 2*i-1 do
write(‘*’);
writeln(”);
end;
end.

2 thoughts on “Perintah FOR – Pascal

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s