ketupat pascal

Posted: 10 Mei 2010 in Algoritma Pemrograman

>Program ketupat dengan pascal:

program belah_ketupat;
uses wincrt;
var
i,j,k,n:integer;
begin
write(‘Masukkan batas= ‘);read(n);
for i:=1 to n do
begin
for k:=(n-1) downto i do
begin
write(‘ ‘);
end;
for j:=1 to i do
begin
write(j,’ ‘);
end;
begin
for j:=(i-1) downto 1 do
write(j,’ ‘);
end;
writeln(‘ ‘);
end;
begin
for i:=(n-1) downto 1 do
begin
for k:=(n-1) downto i do
begin
write(‘ ‘);
end;
for j:=1 to i do
begin
write(j,’ ‘);
end;
begin
for j:=(i-1) downto 1 do
write(j,’ ‘)
end;
writeln(‘ ‘);
end;
end;
end.


syntax pascal klik disini.

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