Var ar:array[1..n] of integer; i,k1,k2:integer; begin randomize; writeln('Аrray:'); for i:=1 to n do begin ar[i]:=random(10); write(ar[i]:4); end; k1:=ar[n]; k2:=ar[n-1]; for i:=n-2 downto 1 do ar[i+2]:=ar[i]; ar[1]:=k2; ar[2]:=k1; writeln; writeln('Final array:'); for i:=1 to n do write(ar[i]:4); end.
Const
n=10;
Var
ar:array[1..n] of integer;
i,k1,k2:integer;
begin
randomize;
writeln('Аrray:');
for i:=1 to n do
begin
ar[i]:=random(10);
write(ar[i]:4);
end;
k1:=ar[n];
k2:=ar[n-1];
for i:=n-2 downto 1 do
ar[i+2]:=ar[i];
ar[1]:=k2;
ar[2]:=k1;
writeln;
writeln('Final array:');
for i:=1 to n do
write(ar[i]:4);
end.