Uses crt; const n = 10; var a,b : array[1..n] of integer; i,j : integer; begin randomize; i := 0; j := 0; for i := 1 to n do begin a[i] := random(21)-10; write(a[i],' '); end; writeln; for i := 1 to n do if (a[i] < 0) and (a[i] mod 2 = 0) then begin j := j+1; b[j] := a[i]; end; for i := 1 to j do writeln(b[i]); readln; end.
15 votes Thanks 21
elizabeth1990
к сожалению, не все отрицательные числа из списка выбирает
elizabeth1990
Нет, все правильно, извините! Спасибо вам!!!
Answers & Comments
Verified answer
Uses crt;const
n = 10;
var
a,b : array[1..n] of integer;
i,j : integer;
begin
randomize;
i := 0;
j := 0;
for i := 1 to n do
begin
a[i] := random(21)-10;
write(a[i],' ');
end;
writeln;
for i := 1 to n do
if (a[i] < 0) and (a[i] mod 2 = 0) then
begin
j := j+1;
b[j] := a[i];
end;
for i := 1 to j do
writeln(b[i]);
readln;
end.