const n=10;
var a,b:array[1..n] of integer;
c:array[1..2*n] of integer;
i,n2:integer;
begin
Randomize;
writeln('a:');
for i:=1 to n do begin
a[i]:=random(21);
write(a[i]:3);
end;
writeln;
writeln('b:');
b[i]:=random(21);
write(b[i]:3);
n2:=n div 2;
for i:=1 to n2 do c[i]:=b[i];
for i:=1 to n do c[i+n2]:=a[i];
for i:=n2+1 to n do c[n+i]:=b[i];
writeln('c:');
for i:=1 to 2*n do write(c[i]:3);
end.
Пример:
a:
3 12 10 16 13 12 9 18 2 0
b:
6 1 12 6 2 14 8 10 20 11
c:
6 1 12 6 2 3 12 10 16 13 12 9 18 2 0 14 8 10 20 11
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Verified answer
const n=10;
var a,b:array[1..n] of integer;
c:array[1..2*n] of integer;
i,n2:integer;
begin
Randomize;
writeln('a:');
for i:=1 to n do begin
a[i]:=random(21);
write(a[i]:3);
end;
writeln;
writeln('b:');
for i:=1 to n do begin
b[i]:=random(21);
write(b[i]:3);
end;
writeln;
n2:=n div 2;
for i:=1 to n2 do c[i]:=b[i];
for i:=1 to n do c[i+n2]:=a[i];
for i:=n2+1 to n do c[n+i]:=b[i];
writeln('c:');
for i:=1 to 2*n do write(c[i]:3);
end.
Пример:
a:
3 12 10 16 13 12 9 18 2 0
b:
6 1 12 6 2 14 8 10 20 11
c:
6 1 12 6 2 3 12 10 16 13 12 9 18 2 0 14 8 10 20 11