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