Program n1; const n=15; var a:array[1..n] of integer; i,k:integer; begin randomize; writeln('исходный массив: '); for i:=1 to n do begin a[i]:=random(15); write(a[i],' '); end; writeln; for i:=1 to n div 2 do begin k:=a[i]; a[i]:=a[n+1-i]; a[n+1-i]:=k; end; writeln('инвертнутый массив:'); for i:=1 to n do write(a[i],' '); end.
Answers & Comments
Verified answer
Program n1;const n=15;
var a:array[1..n] of integer;
i,k:integer;
begin
randomize;
writeln('исходный массив: ');
for i:=1 to n do
begin
a[i]:=random(15);
write(a[i],' ');
end;
writeln;
for i:=1 to n div 2 do
begin
k:=a[i];
a[i]:=a[n+1-i];
a[n+1-i]:=k;
end;
writeln('инвертнутый массив:');
for i:=1 to n do
write(a[i],' ');
end.