function max(a,b,c:real):real;
begin
max:=a;
if b>max then max:=b;
if c>max then max:=c;
end;
function min(a,b,c:real):real;
begin
min:=a;
if b<min then min:= b;
if c< min then min:=c;
end;
bài 2:
Mã:
function perfect(n:word)boolean;
begin
s:=0; perfect:=false;
for i:=1 to n do if n mod i =0 then s:=s+i;
if s=2*n then perfect:= true;
end;