Jumat, 09 April 2010
pascal prosedure
algope 2a 1:
Program satu;
uses crt;
var
i:byte;
procedure garis;
var
counter:integer;
begin
textcolor(green);
for counter:= 1 to 10 do
begin
write(char(196));
end;
end;
begin
for 1:= 1 to 5 do
begin
gotoxy(10,5);
garis;
end;
readln;
end.
algpe2
uses crt;
procedure kali;
var
a,b,c:integer;
begin
write('nilai A= ');readln(a);
write('nilai B= ');readln(b);
c:= a*b;
writeln('hasil c= ',c);
end;
var d,e,f:integer;
procedure jumlah;
begin
write('niali D= ');readln(d);
write('nilai E= ');readln(e);
f:= d*e;
writeln('nilai f= ',f);
end;
begin
clrscr;
kali;
jumlah;
readln;
end.
algope3
procedure kali(a,b:integer);
var
hasil:integer;
begin
hasil:=a*b;
writeln('hasil= ',:6);
end;
var
bil1,bil2:integer;
begin
write('bilangan 1= ');readln(bil1);
write('bilangan 2= ');readln(bil2);
kali(bil1,bil2);
readln;
end.
algpe4
program pengiriman_parameter_secara_acuan;
uses crt;
procedure kali(var a,b,c:integer);
begin
c:=a*b;
end;
var x,y,z:integer;
begin
clrscr;
write('nilai x=');readln(x);
write('nilai y=');readln(y);
kali(x,y,z);
writeln(' niali z=',z);
readln;
end.
algpe5
program panggil;
uses crt;
procedure satu(a1:integer);
begin
writeln(' nilai a=',a1,' procedure satu');
end;
procedure dua(a2:integer);
begin
writeln(' nilai a=',a2,' procedure dua');
satu(a2);
end;
var a:integer;
begin
clrscr;
write(' nilai a=');readln(a);
dua(a);
readln;
end.
algpe6
program tersarang;
uses crt;
procedure satu;
procedure dua;
begin
writeln(' procedure dua ada di procedure satu ');
end;
procedure tiga;
begin
writeln(' procedure tiga ada di procedure satu ');
end;
begin
writeln('procedure satu ');
dua;
tiga;
end;
begin
clrscr;
writeln(' modul utama ');
satu;
readln;
end.
algpe 7
program rekursi;
uses crt;
var i:integer;
procedure rekursi;
begin
writeln(' pemanggil procedure ke=',i);
i := i +1;
if i<5 then rekursi;
end;
begin
clrscr;
i:= j;
rekursi;
readln;
end.
met job.....
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar