Type
TMatrix = array[,] of integer;
TVector = array of integer;
var
A: TMatrix;
B: TVector;
m,n,i,j: integer;
procedure CreateMulVector(A:TMatrix; var B: TVector);
var i, j: integer; f: boolean;
begin
SetLength(B, Length(A, 0));
for i := 0 to Length(A, 0) - 1 do begin
B[i] := 1; f := false;
for j := 0 to Length(A, 1) - 1 do begin
if A[i,j] > 0 then begin
f := true;
B[i] := B[i] * A[i,j];
end;
end;
if not f then B[i] := 0;
end;
end;
procedure WriteVector(B: TVector);
var i: integer;
begin
for i := 0 to Length(B) - 1 do
write(B[i]:3);
end;
begin
randomize;
n := Random(10) + 1;
m := Random(10) + 1;
SetLength(A, n, m);
writeln('Исходная матрица:');
for i := 0 to n-1 do begin
for j := 0 to m-1 do begin
A[i,j] := Random(10) - 5;
write(A[i,j]:4);
end;
writeln;
end;
CreateMulVector(A, B);
writeln('Полученный вектор:');
WriteVector(B);
end.