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.
CONTOH PROGRAM BERBENTUK BINTANG MENURUN
program bintang_turun;
uses wincrt;
var i,n,j:integer;
begin
write('jumlah n : '); readln (n);
for i:=1 to n do
begin for j:=1 to n do
begin if (j<i) then
write (' ') else
write ('*');
end;
writeln;
end;
end.
CONTOH PROGRAM BERBENTUK BINTANG MENURUN BEDA ARAH
program bintang_segitiga_beda_arah;
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.
CONTOH PROGRAM BENTUK BINTANG SELINGAN 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 SEGI EMPAT BOLONG
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.
Langganan:
Posting Komentar (Atom)
8 komentar:
terimakasih cukup membantu ! :)
klao mau buat kayak gini gimana?
**************
**************
**
**
**************
**************
**
**
**************
*************
Kalau buat yg kaya gini gimana ka
*
* *
*
* *
*
Kalo yang kaya gini kak.?
*
**
***
****
*****
****
***
**
*
Klo bikun gni gimana??
X O X O X
O X O X O
X O X O X
O X O X O
X O X O X
mohon dibantu
Posting Komentar