CONTOH PROGRAM PASCAL BENTUK BINTANG




Hay guys.. 😄😄😄
Selamat datang di Adi Surya Blogger
Berikut aku akan bagiin cara membuat bintang di Turbo Pascal, berikut caranya.. 

1.buka turbo pascalnya
2.pilih coding dibawah ini yang anda butuhkan



CONTOH PROGRAM BINTANG PIRAMIDA
uses wincrt;
var 

a,b,c,d:integer; 

begin 

write('masukkan jumlah baris bintang yang akan ditampilkan:');readln(a); 

for b:= 1 to a do 

begin 

for c:= a downto b do 

write(' '); 

for d:= 1 to b+b-1 do 

write('*'); 

writeln; 

end; 

end.
tampilan :
 


CONTOH PROGRAM BERBENTUK BINTANG

program bintang_segitiga;
uses wincrt;
var
a,b,c: integer;

begin
readln(a);
for b:=a downto 1 do
begin
for c:=1 to a do
write('*');
writeln;
a:=a-1;
end;
end.
 Output:
Masukkan jumlah baris 4
****
***
**
*

PROGRAM BINTANG_BELAH_KETUPAT;
uses wincrt;
var
N,i,j,k,max,min : integer;
begin
gotoXY(30,0); writeln('"program belah ketupat"');
gotoXY(30,2); writeln('----------------------------------------');
writeln;
write ('Masukkan Batas : ');readln(N);
writeln;
begin
for i:=1 to (n*2+1) do
begin
write;
end;
begin
for i := 1 to N do
begin
for k := (N-1) downto i do
begin
write (' ');
end;

for j:= 1 to i do
begin
write('* ');
end;
begin
for j:=(i-1) downto 1 do
write('* ');
end;
writeln(' ');
end;
begin
for i := (N-1) downto 1 do
begin
for k := (N-1) downto i do
begin
write (' ');
end;

for j := i downto 1 do
begin
write ('* ');
end;
begin
for j := 1 to (i-1) do
write('* ');
end;
writeln(' ');
end;
end;
end;
end;
end.

CONTOH PROGRAM BERBENTUK BINTANG RATA KIRI
program bintang_segitiga;
uses wincrt;
var i,n,j:integer;
begin
write('masukkan n= ');readln(n);
for i:=n downto 1 do
begin
for j:=1 to n do
begin
if (j<i) then write (' ')
else
write('*');
write(' ');
end;
writeln(' ');
end;
end.
Output: 
masukkan jumlah bintang terbawah : 3
    *
  **
***

CONTOH PROGRAM BENTUK BINTANG DENGAN ANGKA 

program seling;
uses wincrt;
var i,j,n:integer;
a:string;        
begin
write ('banyak baris ');
readln (n);
for i:=1 to n do
begin
for j:=1 to i do
begin
if (j mod 2)=1 then
a:='*' else a:='1';
write(a,' ');
end;
writeln;end;
end.

CONTOH PROGRAM BENTUK BINTANG LUAS SEGI EMPAT 

program persegi;
uses winCrt;
procedure gb (brs,kol:integer);
var i,j:integer;
begin
for i:=1 to brs do
    begin
    for j:=1 to kol do
        begin
        if ((i=1)or(i=brs)or(j=1)or(j=kol))then
        write ('*')
        else write(‘  ‘);
        end;
        writeln;
        end;                  
    end;
        var x,y:integer;
        begin                
        write('banyak baris= ');readln(y);
        write('banyak kolom= ');readln(x);
        writeln('bentuknya:');
        gb(y,x);
        end.
Output:
Banyaknya baris 3
Banyaknya kolom 4
****
*    *
****



Posting Komentar

1 Komentar

  1. How do you make money from gambling? - Work
    The main 바카라 사이트 idea of gambling is that titanium tubing you will get into it as if 사설토토 you own หารายได้เสริม a horse and you are going to be placing bets on horses you 바카라 사이트 주소 might choose to bet

    BalasHapus