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 :
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 :
gan, gimana cara bikin kek gini
BalasHapus*
**
***
****
*****
*****
****
***
**
*
gan gimana cara buat seperti ini
BalasHapus1
1 2
1 2 3
1 2
1
ulangi y/n
Gan, cara membuat huruf A dengan karakter bintang gmn gan
BalasHapus