CLS
INPUT "Kolvo strok="; n
INPUT "Kolvo stolbcov="; m
DIM a(n, m)
RANDOMIZE TIMER
PRINT "Ishodnaya matrica"
FOR i = 1 TO n
FOR j = 1 TO m
a(i, j) = INT(RND * 100) - 50
NEXT j
NEXT i
FOR i = 1 TO n
FOR j = 1 TO m
PRINT a(i, j);
NEXT j
PRINT
NEXT i
PRINT
max = a(1, 1): min = a(1, 1): imin = 1: jmin = 1: imax = 1: jmax = 1
FOR i = 1 TO n
FOR j = 1 TO m
IF a(i, j) < min THEN min = a(i, j): imin = i: jmin = j
IF a(i, j) > max THEN max = a(i, j): imax = i: jmax = j
NEXT j
NEXT i
SWAP a(imin, jmin), a(imax, jmax)
PRINT "maks element="; max
PRINT "min element="; min
PRINT "Matrica posle preobrazovaniy"
FOR i = 1 TO n
FOR j = 1 TO m
PRINT a(i, j);
NEXT j
PRINT
NEXT i
Тестирование выполнено в программе QB64 ( Скачать )