program MatrixProduct;
const
M = 5;
N = 10;
var
matrix: array[1..M, 1..N] of integer;
products: array[1..M] of real;
i, j: integer;
maxProductRow, minProductRow: integer;
maxProduct, minProduct: real;
begin
randomize;
for i := 1 to M do
for j := 1 to N do
matrix[i, j] := random(21) - 10;
for i := 1 to M do
begin
products[i] := 1;
for j := 1 to N do
if matrix[i, j] <> 0 then
products[i] := products[i] * matrix[i, j];
end;
maxProductRow := 1;
minProductRow := 1;
maxProduct := products[1];
minProduct := products[1];
for i := 2 to M do
begin
if products[i] > maxProduct then
begin
maxProduct := products[i];
maxProductRow := i;
end;
if products[i] < minProduct then
begin
minProduct := products[i];
minProductRow := i;
end;
end;
writeln('Строка с максимальным произведением: ', maxProductRow);
writeln('Строка с минимальным произведением: ', minProductRow);
end.