Write a program that would find the sum of the odd elements of a one-dimensional integer array.

Write a program that would find the sum of the odd elements of a one-dimensional integer array. The way to fill the array is any (either using the random function or using a simple assignment).

program zz1;
const n = 5; // set the number of elements in the array
var i, k: integer; // set variables of integer type
m: array [1..n] of integer;
begin
for i: = 1 to n do // write numbers in the array at random
m [i]: = random (21);
for i: = 1 to n do // display the array on the screen
write (m [i], ”);
writeln; // go to a new line for output
for i: = 1 to n do
if m [i] mod 2 = 1 then begin k: = m [i] + k; end; // check if the array element is divisible by two with one remainder, then add it to the sum
writeln (‘the sum of the odd array elements =’, k); // display the answer
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.