program MultiplicationOfElementsGreaterThan20;
vararr: array of Integer;N, i: Integer;product: Integer;
beginWrite('Enter the number of elements in the array: ');ReadLn(N);
SetLength(arr, N);
Randomize;
// Initialize the array with random values between -20 and 60for i := 0 to N - 1 dobeginarr[i] := Random(81) - 20;end;
product := 1;
for i := 0 to N - 1 dobeginif arr[i] > 20 thenbeginproduct := product * arr[i];end;end;
WriteLn('Original array:');for i := 0 to N - 1 dobeginWrite(arr[i], ' ');end;
WriteLn;WriteLn('The product of all elements greater than 20 is: ', product);end.
program MultiplicationOfElementsGreaterThan20;
var
arr: array of Integer;
N, i: Integer;
product: Integer;
begin
Write('Enter the number of elements in the array: ');
ReadLn(N);
SetLength(arr, N);
Randomize;
// Initialize the array with random values between -20 and 60
for i := 0 to N - 1 do
begin
arr[i] := Random(81) - 20;
end;
product := 1;
for i := 0 to N - 1 do
begin
if arr[i] > 20 then
begin
product := product * arr[i];
end;
end;
WriteLn('Original array:');
for i := 0 to N - 1 do
begin
Write(arr[i], ' ');
end;
WriteLn;
WriteLn('The product of all elements greater than 20 is: ', product);
end.