program bintang;
var
b,i,j,n,m: integer;
label l;
begin
write('Masukkan sebuah bilangan ganjil : ');readln(n);
if (n mod 2) = 0 then goto l;
i:=1;
m:=n;
while i < n+2 do
begin
if m>0 then
write(' ':m);
if i mod 2 <> 0 then
begin
for j:= 1 to i do
begin
write('*');
end;
if m > 0 then
if m > 0 then
m:= m-1
else m:= 0;
end;
i:= i+1;
writeln;
end;
l:
readln;
end.
No comments:
Post a Comment