for to dan for downto – pascal


Program ulang_08;

uses crt;

var

i,kiri,bawah,kanan,atas : integer;

xa1,ya1,xa2,ya2 : integer;

begin

clrscr;

writeln(‘Menampilkan * Obat Nyamuk’);

xa1 := 1; ya1 :=1;

xa2 := 80; ya2 :=49;

for i :=1 to 12 do

begin

for kanan:=xa1 to xa2 do

begin

gotoxy(kanan,ya1);write(‘>’);

end;

for bawah:=ya1 to ya2 do

begin

gotoxy(xa2,bawah);write(‘v’);

end;

xa1 := xa1 + 2;

for kiri:=xa2 downto xa1 do

begin

gotoxy(kiri,ya2);write(‘<‘);

end;

ya1 := ya1 + 2;

for atas:=ya2 downto ya1 do

begin

gotoxy(xa1,atas);write(‘^’);

end;

xa2 := xa2 – 2;

ya2 := ya2 – 2;

end;

end.

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