Write a program in which an array of 20 elements is filled with random numbers

Write a program in which an array of 20 elements is filled with random numbers and the product of all elements of the array is calculated.

program zz1;

const n = 20; // set the number of elements in the array

var i, k: integer; // set variables of integer type

m: array [1..n] of integer;

begin

k: = 1; // set the initial value for the product

for i: = 1 to n do // get numbers randomly and write them into an array

m [i]: = random (4) +1;

for i: = 1 to n do // display the resulting array on the screen

write (m [i], ”);

writeln; // go to a new line to display the response

for i: = 1 to n do // organize a loop in which we iterate over the array elements

k: = k * m [i]; // multiply by the product

write (‘product of 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.