Form an array of 10 random integers from the range from – 5 to 5

Form an array of 10 random integers from the range from – 5 to 5, put the array elements in a string with a space, find the sum of all positive elements.

var
i, sum: integer; // declare variables of integer type.
arr: array [1..10] of integer; // declare an array.
Begin
for i: = 1 to 10 do // start of the cycle.
begin
arr [i]: = random (-5, 5); // fill the array with random numbers from the range -5; 5.
write (arr [i] + ”); // display the array elements in one line
if (arr [i]> 0) then // check if the current element is positive.
sum: = sum + arr [i]; // count the sum of positive elements.
end;
writeln; // go to the next line.
writeln (‘The sum of the positive elements of the array is:’, sum); // display the string.
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.