Const n=6;
var x:array[1..n] of integer=(-1, 1, 2, -2, -3, 3);
y,z:array[1..n] of integer;
i,i1,i2:integer;
begin
for i:=1 to n do write(x[i]:3);
writeln;
i1:=0; i2:=0;
for i:=1 to n do
if x[i]>0 then begin i1:=i1+1; y[i1]:=x[i]; end
else if x[i]<0 then begin i2:=i2+1; z[i2]:=x[i]; end;<br>writeln(' Y: Z:');
for i:=1 to n do
if (i1>=i)and(i2>=i)
then writeln(y[i]:3,z[i]:4)
else if i1>=i then writeln(y[i]:3)
else if i2>=i then writeln(z[i]:7);
end.
Результат:
-1 1 2 -2 -3 3
Y: Z:
1 -1
2 -2
3 -3