Const N = 10;Const M = 10;Var A:Array [1..N, 1..M] Of Integer; i, j, imax, jmax, imin, jmin, temp:Integer; Begin randomize; For i := 1 to N do Begin For j := 1 to M do Begin A[i, j] := random(1000); End; End; imin := 1; imax := 1; jmin := 1; jmax := 1; For i := 1 to N do Begin For j := 1 to M do Begin If A[i, j] > A[imax, jmax] then Begin imax := i; jmax := j; End; If A[i, j] < A[imin, jmin] then Begin imin := i; jmin := j; End; End; End; writeln('first elem: ', A[imax, jmax], ', second elem: ', A[imin, jmin]); temp := A[imin, jmin]; A[imin, jmin] := A[imax, jmax]; A[imax, jmax] := temp; writeln('first elem: ', A[imax, jmax], ', second elem: ', A[imin, jmin]);End.