An array B (n) is given. Determine the product of elements that are multiples of 3.

An array B (n) is given. Determine the product of elements that are multiples of 3. Display the original array and the found product.

program zz1;
const n = 5; // set the number of elements in the array
var i, p: integer; // set variables of integer type
b: array [1..n] of integer;
begin
for i: = 1 to n do // get n random numbers and write them into an array
b [i]: = random (51);
for i: = 1 to n do // display the resulting array on the screen
write (b [i], ”);
writeln; // go to a new line to display the response
p: = 1;
for i: = 1 to n do
if b [i] mod 3 = 0 then p: = p * b [i]; // get the product
if p = 1 then write (‘there are no multiples of three’) else writeln (‘the product of array elements =’, p); // 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.