Var ar,ar2:array[1..10] of integer; i:integer; begin randomize; writeln('First array:'); for i:=1 to 10 do begin; ar[i]:=random(10)-3; write(ar[i]:4); if ar[i]=0 then ar2[i]:=0; end; writeln; writeln('1-st Final array:'); for i:=1 to 10 do begin; write(ar2[i]:4); if ar[i]<0 then ar2[i]:=ar[i]; end; writeln; writeln('2-st Final array:'); for i:=1 to 10 do begin; write(ar2[i]:4); if ar[i]>0 then ar2[i]:=ar[i]; end; writeln; writeln('3-st Final array:'); for i:=1 to 10 do write(ar2[i]:4); end.
ar,ar2:array[1..10] of integer;
i:integer;
begin
randomize;
writeln('First array:');
for i:=1 to 10 do
begin;
ar[i]:=random(10)-3;
write(ar[i]:4);
if ar[i]=0 then ar2[i]:=0;
end;
writeln;
writeln('1-st Final array:');
for i:=1 to 10 do
begin;
write(ar2[i]:4);
if ar[i]<0 then ar2[i]:=ar[i];
end;
writeln;
writeln('2-st Final array:');
for i:=1 to 10 do
begin;
write(ar2[i]:4);
if ar[i]>0 then ar2[i]:=ar[i];
end;
writeln;
writeln('3-st Final array:');
for i:=1 to 10 do
write(ar2[i]:4);
end.