Const n=10;
var a:array[1..n] of integer;
max,i:integer;
begin
Randomize;
for i:=1 to n do begin
a[i]:=random(51);
write(a[i],' ');
end;
writeln;
max:=a[1];
for i:=1 to (n-1) div 2 do
if a[2*i+1]>max then max:=a[2*i+1];
writeln('max = ',max);
end.
Пример:
20 31 42 35 5 44 11 23 26 27
max = 42