Procedure FPC


Program Garis;
uses crt;

VAR
i : Integer;

{Procedure}
PROCEDURE garis(n: Integer);
Begin
For i:= 1 To n Do
write(‘=’);
writeln(”);
end;

{Program Utama}
BEGIN
clrscr;
garis(10);
writeln(‘Garis 10’);
garis(20);
writeln(‘Garis 20’);
END.

=========

Program Kotak;
uses crt;

VAR
i, j : Integer;

{Procedure}
PROCEDURE kotak1(x,y: Integer);
Begin
For i:= 1 To x Do
write(‘=’);
writeln(”);
for i:=1 to y-2 do
begin
write(‘|’);
for j:= 1 to x-2 do
write(‘ ‘);
writeln(‘|’);
end;
For i:= 1 To x Do
write(‘=’);
writeln(”);
end;

{Program Utama}
BEGIN
clrscr;
kotak1(10,10);
kotak1(30,20);

END.

===========

Program Kotak;
uses crt;

VAR
i, j : Integer;

{Procedure}
PROCEDURE kotak1(x1,y1,x2,y2: Integer);
Begin
For i:= x1 To x2 Do
begin
gotoxy(i,y1);write(‘=’);
gotoxy(i,y2);write(‘=’);
end;
For i:= y1 To y2 Do
begin
gotoxy(x1,i);write(‘|’);
gotoxy(x2,i);write(‘|’);
end;
end;

{Program Utama}
BEGIN
clrscr;
kotak1(1,1,10,10);

for j := 10 to 20 do
begin
kotak1(1,1,j,j);
end;

for j := 1 to 10 do
begin
kotak1(0+j,0+j,20-j,20-j);
end;

END.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s