Pages

October 30, 2012

Membuat 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  :






Comments
0 Comments

0 komentar:

Post a Comment

Daftar Artikel