program Project2;
{$APPTYPE CONSOLE}
uses
SysUtils;
type TMatrix=array [1..100,1..100] of integer;
procedure Mtrx(Var m,n:integer; Var a:TMatrix);
var
i,j:integer;
begin
write('kol-vo strok ');
readln(m);
write('kol-vo stolbcov ');
readln(n);
writeln;
randomize;
j:=1;
while j<=n do
begin
i:=1;
repeat
a[i,j]:=random (41)-20;
write (a[i,j]:4);
i:=i+1;
until i>m;
writeln;
j:=j+1;
end;
end;
procedure poisk(m,n:integer;a:TMatrix; Var b:TMatrix);
var
i,j,max:integer;
begin
max:=a[i,j];
for j:=1 to n do
begin
for i:=1 to m do
begin
if a[i,j]>=0 then
begin
b[i,j]:=(-1)*a[i,j];
end
else
begin
b[i,j]:=(-1)*a[i,j];
end;
write (b[i,j]:4);
end;
writeln;
end;
end;
procedure maxi(m,n:integer;a:TMatrix; Var max:integer);
Var
i,j:integer;
begin
max:=a[1,1];
for j:=1 to n do
begin
for i:=1 to m do
begin
if a[i,j]>=a[1,1] then
begin
max:=a[i,j]
end;
end;
end;
writeln ('max. value= ',max);
end;
procedure mini(m,n:integer; a:TMatrix; Var min:integer);
Var
i,j:integer;
begin
min:=a[1,1];
for j:=1 to n do
begin
for i:=1 to m do
begin
if a[i,j]<=a[1,1] then
begin
min:=a[i,j];
end;
end;
end;
writeln ('min. value= ', min);
end;
Var
m,n,max,min:integer;
a,b:TMatrix;
Begin
Mtrx(m,n,a);
writeln;
maxi(m,n,a,max);
writeln;
mini(m,n,a,min);
writeln;
poisk(m,n,a,b);
readln;
End.