uses crt;
type
matrica=array[1..14,1..12] of integer;
var
a,c:matrica;
p1,p2:integer;
procedure input(var d:matrica;n,k:integer);
var
i,j:integer;
begin
randomize;
for i:=1 to n do begin
for j:=1 to k do
d[i,j]:=random(10);
end;
End;
Procedure output(var d:matrica;n,k:integer);
var
i,j:integer;
begin
for i:=1 to n do begin
for j:=1 to k do
Write(d[i,j]:4);
Writeln('');
End;
end;
function p (d:matrica;n,k:integer):integer;
var
i,j,proiz:integer;
begin
proiz:=1;
for i:=1 to n do begin
for j:=1 to k do
if d[i,j]>0 then
proiz:=proiz*d[i,j];
p:=proiz;
End;
End;
begin
input(a,14,12);
input(c,10,7);
Writeln('matrica a');
output(a,14,12);
Writeln('matrica c');
output(a,10,7);
readkey;
p1:=p(a,14,12);
p2:=p(c,10,7);
Writeln('p=',p1);
Writeln('p=',p2);
Readln;
End.
помогите ошибку найти.он постоянно обнуляет произведение.