Const n=8;
var a:array[1..n] of integer;
b,i:integer;
begin
Randomize;
for i:=1 to n do
begin
a[i]:=random(20)+1;
write(a[i]:3);
end;
writeln;
for i:=1 to n div 2 do
begin
b:=a[i]; a[i]:=a[n-i+1]; a[n-i+1]:=b
end;
for i:=1 to n do write(a[i]:3);
writeln;
end.
Пример:
9 5 6 11 13 4 16 18
18 16 4 13 11 6 5 9