Function

15 03 2010

Program 1 :

uses crt;
type huruf=string[6];
function garis:huruf;
begin
garis:=’==========’;
end;
begin
clrscr;
writeln(garis);
writeln(‘pascal’);
writeln(garis);
readln;
end.

Program 2 :

uses crt;
function terbesar(x,y:real):real;
begin
if x>y then
terbesar:=x;
terbesar:=y;
end;
var
nilai1,nilai2:real;
begin
clrscr;
write(‘Nilai Pertama=’);readln(nilai1);
write(‘Nilai Kedua=’);readln(nilai2);
writeln(‘Nilai terbesar adalah=’,terbesar(nilai1,nilai2):0:2);
readln;
end.


Actions

Information

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




%d bloggers like this: