Const N = 30; Var A,B:array[1..N] of integer; i,S,M:integer; Begin Randomize; Write('A(',N,'):'); M:=0; For i:= 1 to N do Begin A[i]:=random(11)-5; Write(' ',A[i]); if A[i] > 0 then Begin M:=M+1; B[M]:=A[i]; End End; WriteLn; Write('B(',M,'):'); For i:= 1 to M do Write(' ',B[i]); ReadLn; End.
N = 30;
Var
A,B:array[1..N] of integer;
i,S,M:integer;
Begin
Randomize;
Write('A(',N,'):');
M:=0;
For i:= 1 to N do
Begin
A[i]:=random(11)-5;
Write(' ',A[i]);
if A[i] > 0 then
Begin
M:=M+1;
B[M]:=A[i];
End
End;
WriteLn;
Write('B(',M,'):');
For i:= 1 to M do
Write(' ',B[i]);
ReadLn;
End.