Pascal: (Numerele vor fi luate radom)
const N = 10;
var
a: array[1..N] of integer;
i: byte;
min, max: integer;
begin
randomize;
for i:=1 to N do a[i]:=random(100);
for i:=1 to N do write(a[i]:4);
writeln;
min := 100;
max := -1;
for i:=1 to N do begin
if a[i] > max then max := a[i]
else if a[i] < min then min := a[i];
end;
writeln(max,'-',min,'=',max-min);
end.