Program Mencetak Ketupat
Program ketupat;
uses wincrt;
var
a,b,c,d:integer;
lagi : char;
begin
lagi:='y';
repeat
clrscr;
writeln('------------------------------');
writeln(' program mencetak ketupat ');
writeln('------------------------------');
writeln;
write(' Masukkan diagonal ketupat : ');readln(a);
for c:=1 to a do
begin
for d:=1 to a-c do
begin
write(' ');
end;
for b:=1 to c do
begin
write('*',' ');
end;
writeln('');
end;
if (c=a) then
begin
for c:=a-1 downto 1 do
begin
for d:=1 to a-c do
begin
write(' ');
end;
for b:=1 to c do
begin
write('*',' ');
end;
writeln('');
end;
end;
writeln;
write('Ulangi ? (Y/T) : ');readln(lagi);
until (lagi='t')or(lagi='T');
donewincrt;
end.
screenshot output program