Var ma:array of array of integer; n,m,i,j,res:integer; b:boolean; begin randomize; res:=1; b:=false; read(m,n); setlength(ma,m); for i:=0 to m-1 do setlength(ma[i],n); writeln('First matrix:'); for i:=0 to m-1 do begin writeln; for j:=0 to n-1 do begin ma[i,j]:=random(10); write(ma[i,j]:5); end; end; if n>m then begin for i:=0 to m-1 do for j:=i+1 to n-1 do if ma[i,j]>0 then begin; res:=res*ma[i,j]; b:=true; end; end else begin for i:=0 to n-1 do for j:=i+1 to n-1 do if ma[i,j]>0 then begin; res:=res*ma[i,j]; b:=true; end; end; if b=false then res:=0; writeln; writeln('Final array:'); for i:=0 to m-1 do begin writeln; for j:=0 to n-1 do begin if ma[i,j]=0 then ma[i,j]:=res; write(ma[i,j]:5); end; end; writeln; writeln('res=',res); end.
Var a: array[1..100, 1..100] of integer; i, j, m, n, count2, countx, x: integer;
begin {ввод матрицы} n := 10;
writeln('Данные матрицы:'); for i := 1 to n do begin for j := 1 to n do begin a[i, j] := random(200) - 100; write(a[i, j]:4, ' ') end; writeln; end;
write('x = '); readln(x); count2 := 0; countX := 0; for i := 1 to n do for j := 1 to n do begin if a[i, j] = x then countX := countX + 1; if (a[i, j] >= 10) and (a[i, j] <= 99) and ((a[i, j] div 10 + a[i, j] mod 10) mod 2 = 0) then count2 := count2 + 1; end; writeln('countX = ', countX); writeln('count2 = ', count2); end.
Var
ma:array of array of integer;
n,m,i,j,res:integer;
b:boolean;
begin
randomize;
res:=1;
b:=false;
read(m,n);
setlength(ma,m);
for i:=0 to m-1 do
setlength(ma[i],n);
writeln('First matrix:');
for i:=0 to m-1 do
begin
writeln;
for j:=0 to n-1 do
begin
ma[i,j]:=random(10);
write(ma[i,j]:5);
end;
end;
if n>m then
begin
for i:=0 to m-1 do
for j:=i+1 to n-1 do
if ma[i,j]>0 then
begin;
res:=res*ma[i,j];
b:=true;
end;
end
else
begin
for i:=0 to n-1 do
for j:=i+1 to n-1 do
if ma[i,j]>0 then
begin;
res:=res*ma[i,j];
b:=true;
end;
end;
if b=false then res:=0;
writeln;
writeln('Final array:');
for i:=0 to m-1 do
begin
writeln;
for j:=0 to n-1 do
begin
if ma[i,j]=0 then ma[i,j]:=res;
write(ma[i,j]:5);
end;
end;
writeln;
writeln('res=',res);
end.
a: array[1..100, 1..100] of integer;
i, j, m, n, count2, countx, x: integer;
begin
{ввод матрицы}
n := 10;
writeln('Данные матрицы:');
for i := 1 to n do
begin
for j := 1 to n do
begin
a[i, j] := random(200) - 100;
write(a[i, j]:4, ' ')
end;
writeln;
end;
write('x = ');
readln(x);
count2 := 0;
countX := 0;
for i := 1 to n do
for j := 1 to n do
begin
if a[i, j] = x then
countX := countX + 1;
if (a[i, j] >= 10) and (a[i, j] <= 99) and ((a[i, j] div 10 + a[i, j] mod 10) mod 2 = 0) then
count2 := count2 + 1;
end;
writeln('countX = ', countX);
writeln('count2 = ', count2);
end.