CLS
INPUT "kolvo strok="; n
INPUT "kolvo stolbcov="; m
DIM a(n, m)
RANDOMIZE TIMER
FOR i = 1 TO n
FOR j = 1 TO m
a(i, j) = INT(RND * 100) - 50
PRINT a(i, j);
NEXT j
PRINT
NEXT i
PRINT
max = a(1, 1)
FOR i = 1 TO n
FOR j = 1 TO m
IF a(i, j) > max THEN max = a(i, j)
NEXT j
NEXT i
k = 0
FOR j = 1 TO m
IF a(1, j) = max THEN k = 1
IF a(n, j) = max THEN k = 1
NEXT j
IF k = 0 THEN
FOR j = 1 TO m
SWAP a(1, j), a(n, j)
NEXT j
FOR i = 1 TO n
FOR j = 1 TO m
PRINT a(i, j);
NEXT j
PRINT
NEXT i
END IF
Тестирование выполнено в программе QB64 ( Скачать )