Find the arithmetic mean of positive elements of array A (100) filled with random numbers

Find the arithmetic mean of positive elements of array A (100) filled with random numbers in the range from -20 to +20.

var
i, sum, x: integer; // declare variables of integer type.
arr: array [1..100] of integer; // declare an array.
Begin
for i: = 1 to 100 do // start of the cycle.
begin
arr [i]: = random (-20,20); // fill the array element with a number from -20 to 20.
if arr [i]> 0 then // if the element is positive, then ..

begin
sum: = sum + arr [i]; // count the sum of positive elements.
x: = x + 1; // count the number of positive elements.
end;

end;
writeln (‘The arithmetic mean of positive array elements:’, round (sum / x));
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.