program bintang_piramid;
uses wincrt;
var c,a,b,n : integer;
begin
write ('masukkan jumlah bintang terakir : ');readln(n);
writeln;
if n mod 2 = 0 then
for a := 1 to (n div 2) do begin
for b := 1 to (n div 2)-a do
write (' ');
for c := 1 to (a*2) do
write ('*');
writeln;
end
else
for a := 1 to (n div 2)+1 do begin
for b := 1 to (n div 2)+(1-a) do
write (' ');
for c := 1 to (a*2)-1 do
write ('*');
writeln;
end;
end.
Tidak ada komentar:
Posting Komentar