Uses crt; const n=10; var a:array [1..n] of integer; i,k: integer; begin randomize; for i:=1 to n do begin a[i]:=random(100); writeln(a[i]); end; writeln; for i:=1 to n-1 do begin if abs(a[i])=abs(a[i+1]) then begin if ((a[i]>0) and (a[i+1]<0)) or ((a[i]<0) and (a[i+1]>0)) then inc(k); end; end; writeln(k); end.
const n=10;
var a:array [1..n] of integer;
i,k: integer;
begin
randomize;
for i:=1 to n do
begin
a[i]:=random(100);
writeln(a[i]);
end;
writeln;
for i:=1 to n-1 do
begin
if abs(a[i])=abs(a[i+1])
then
begin
if ((a[i]>0) and (a[i+1]<0)) or ((a[i]<0) and (a[i+1]>0))
then
inc(k);
end;
end;
writeln(k);
end.