Program P;
const n=14;
var
a: array [1..n] of integer;
i,max:integer;
begin
Randomize;
for i:=1 to n do begin
a[i]:=random(21);
write(a[i]:3);
end;
writeln;
max:=a[1]+a[n];
for i:=2 to n div 2 do
if a[i]+a[n-i+1]>max then max:=a[i]+a[n-i+1];
writeln('max = ',max);
end.
Пример:
11 2 15 15 8 3 8 12 19 18 7 2 11 8
max = 26