Const n=15;
type ar=array[1..n] of integer;
procedure p1(var a:ar);
var i:integer;
begin
for i:=1 to n do a[i]:=random(101);
end;
procedure p2(var a:ar);
var i:integer;
begin
for i:=1 to n do write(a[i],' ');
writeln;
end;
function min(var a:ar):integer;
var m,i:integer;
begin
m:=100;
for i:=1 to n do
if (a[i]=20) then m:=a[i];
min:=m;
end;
var a:ar;
begin
Randomize;
p1(a);
p2(a);
writeln('min = ',min(a));
end.
Пример:
15 59 25 47 3 53 57 91 13 22 99 12 53 87 68
min = 22