Var ma:array[1..n,1..n] of real; i,j:integer; r:real; begin randomize; r:=1; writeln('Matrix:'); for i:=1 to n do begin; writeln; for j:=1 to n do begin; ma[i,j]:=random(1,10); if j mod 2<>0 then r:=r*ma[i,j]; write(ma[i,j]:4); end; end; writeln; writeln('Res=',r); end.
Пример работы кода: Matrix: 5 3 3 2 2 5 10 2 4 Res=6000
Const
n=3;
Var
ma:array[1..n,1..n] of real;
i,j:integer;
r:real;
begin
randomize;
r:=1;
writeln('Matrix:');
for i:=1 to n do
begin;
writeln;
for j:=1 to n do
begin;
ma[i,j]:=random(1,10);
if j mod 2<>0 then r:=r*ma[i,j];
write(ma[i,j]:4);
end;
end;
writeln;
writeln('Res=',r);
end.
Пример работы кода:
Matrix:
5 3 3
2 2 5
10 2 4
Res=6000