Home

 FUNGSI DAN PROSEDUR PADA PASCAL

Download Software TPW1.5 

Contoh Fungsi :

program f_jumlah;

Uses Wincrt;

Var
X, Y : integer ;

Function Hitung(Var A,B : integer): integer;
Begin
Hitung := A + B;
End;

Begin
Write(‘Nilai X ?   ‘); readln(X);
Write(‘Nilai Y ?   ‘); readln(Y);
Writeln;
Writeln(X,’ + ‘,Y,’ = ‘, Hitung(X,Y));
End.

Hasilnya :

  

Contoh Prosedur :

program P_Garis;
uses wincrt;

Procedure Garis;
Begin
Writeln(‘—————————————-’);
End;

Begin
Garis;
Writeln(‘Rekayasa Perangkat Lunak’);
Garis;
Writeln(‘Nama   : Tukul’);
Writeln(‘alamat : Semarang’);
garis;
End.

Hasil  :

About these ads

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s