# In a two-dimensional array, find the number of even numbers and the arithmetic mean of all elements in the array.

August 17, 2021 | education

| program zz1;

const n = 4;

m = 7; // set the number of elements in the array

var i, j, k, s: 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

begin

for j: = 1 to m do

if a [i, j] mod 2 = 0 then k: = k + 1;

s: = s + a [i, j];

end;

writeln (‘the number of even elements of the array =’, k); // display the answer

write (‘average of array elements =’, s / (n * m));

end.

One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.