Find the product of the elements of the array A (12), which are divisible by 4.
Find the product of the elements of the array A (12), which are divisible by 4. The elements of the array are random numbers issued by the function instead of the readln operator use M [i]: = random (100).
program zz1;
const n = 12; // set the number of elements in the array
var i, s: integer; // set variables of integer type
m: array [1..n] of integer;
begin
for i: = 1 to n do // get n random numbers and write them into an array
m [i]: = random (100);
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
s: = 1;
for i: = 1 to n do // organize a loop in which we iterate over all the elements of the array
if m [i] mod 4 = 0 then s: = s * m [i] ;; // get the product of elements that are divisible by four
write (‘the product of the elements of the array A (12), which are divisible by 4 =’, s); // display the answer
end.