Не находятся коофициенты наименьшего числа. Кто ошибку найдёт?
Код
Program MaxMin;
uses crt;
var i,j,m,n,k,l,s,t,y,x : integer;
max, min : integer;
maxi,maxj,mini,minj : integer;
A, B, C: array[1..10,1..10] of integer;
Begin
clrscr;
Write('koli4estvo strok, ne bolee 10 - '); ReadLn(N);
Write('koli4estvo stolbcov, ne bolee 10 - '); ReadLn(M);
if ((1>n) or (n>10) or (1>m) or (m>10))
then begin writeln; writeln('OSHIBKA'); readln; halt; end;
For i := 1 to N do
For j := 1 to M do
begin Write('A[',i, ',',j,']= ');
ReadLn(A[i, j]);
end;
WriteLn;
WriteLn(' matrica A');
WriteLn;
For i := 1 to N do
begin
For j := 1 to M do Write(A[i, j] : 5 );
WriteLn;
WriteLn;
end;
max:=A[1,1];
for i:=1 to n do begin
for j:=1 to m do
if A[i,j]>max then max:=A[i,j]
end; writeln ('naibolshii element = ', max);
min:=A[1,1];
for i:=1 to n do begin
for j:=1 to m do
if A[i,j]<min then min:=A[i,j];
end;writeln ('naimenshii element = ', min);
writeln;
for i:=1 to n do begin
for j:=1 to m do
if A[i,j]>A[maxi, maxj] then begin
maxi:=i; maxj:=j; end; end;
for i:=1 to n do begin
for j:=1 to m do
if A[i,j]<A[mini, minj] then begin
mini:=i; minj:=j; end; end;
writeln (' mini=',mini,' minj=',minj,' maxi=',maxi,' maxj=',maxj); writeln;
A[maxi, maxj]:= min;
A[mini, minj]:= max;
WriteLn(' otvet= ');
WriteLn;
For i := 1 to N do
begin
For j := 1 to M do Write(A[i, j] : 5 );
WriteLn; WriteLn; end;
Readkey;
clrscr;
end.
P.S. Со второй задачей помогите плз