Const m=10;
var a:array[1..m] of integer;
i,k:integer;
begin
Randomize;
for i:=1 to m do begin
a[i]:=random(21)-10;
write(a[i],' ');
end;
writeln;
k:=0;
for i:=m downto 1 do
if a[i]<0 then begin k:=k+1; write(a[i],' '); end;<br>writeln;
writeln('k = ',k);
end.
Пример:
4 2 5 -6 0 -10 8 -1 2 -9
-9 -1 -10 -6
k = 4