Introduce array A (N, M). Determine the number of positive and negative elements.
program zz1;
const n = 4;
m = 7; // set the number of elements in the array
var i, j, k: integer; // set variables of integer type
a: array [1..n, 1..m] of integer;
begin
for i: = 1 to n do
for j: = 1 to m do // get numbers and write them into an array
a [i, j]: = random (101) -50;
for i: = 1 to n do // display the resulting array on the screen
begin
for j: = 1 to m do
write (a [i, j]: 4);
writeln;
end;
for i: = 1 to n do
for j: = 1 to m do
if a [i, j]> 0 then k: = k + 1; // check if the element is positive, then count it
writeln (‘the number of positive array elements =’, k); // display the answer
k: = 0;
for i: = 1 to n do
for j: = 1 to m do
if a [i, j] <0 then k: = k + 1; // check if the element is negative, then count it
write (‘number of negative array elements =’, k); // display the answer
end.