var k_nuley, k_sosedey, i : integer;
a : array [1..100] of real;
Begin
read(n);
for i:= 1 to n do read(a[i]);
for i:= 1 to n do Begin
if a[i] = 0 then Begin
k_nuley := k_nuley + 1;
if a[i + 1] < 0 then k_sosedey := k_sosedey + 1;
if a[i - 1] < 0 then k_sosedey := k_sosedey + 1;
end;
write(k_nuley, k_sosedey);
end.
Объяснение:
derzay, bratka
var k_nuley, k_sosedey, i : integer;
a : array [1..100] of real;
Begin
read(n);
for i:= 1 to n do read(a[i]);
for i:= 1 to n do Begin
if a[i] = 0 then Begin
k_nuley := k_nuley + 1;
if a[i + 1] < 0 then k_sosedey := k_sosedey + 1;
if a[i - 1] < 0 then k_sosedey := k_sosedey + 1;
end;
end;
write(k_nuley, k_sosedey);
end.
Объяснение:
derzay, bratka