Senin, 27 Desember 2010

Ni source codenya :

program bintang_piramid;
uses wincrt;

var c,a,b,n : integer;
begin
writeln('************************************');
writeln('* Program segitiga bintang piramid *');
writeln('************************************');

write ('Masukkan angka : '); readln (n);
writeln;
writeln('Hasilnya : ');
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.


Ni gambar running programnya :

Categories:

3 komentar:

  1. gan, gimana cara bikin kek gini
    *
    **
    ***
    ****
    *****
    *****
    ****
    ***
    **
    *

    BalasHapus
  2. gan gimana cara buat seperti ini
    1
    1 2
    1 2 3
    1 2
    1

    ulangi y/n

    BalasHapus
  3. Gan, cara membuat huruf A dengan karakter bintang gmn gan

    BalasHapus