DIM a(7, 4)
PRINT "ishodnyj massiv"
RANDOMIZE TIMER
FOR i = 1 TO 7
FOR j = 1 TO 4
a(i, j) = INT(RND * 20)
PRINT a(i, j);
NEXT
PRINT
NEXT
maxi = 1
maxj = 1
FOR i = 1 TO 7
FOR j = 1 TO 4
IF a(i, j) > a(maxi, maxj) THEN maxi = i: maxj = j
NEXT
NEXT
PRINT "maximalnyj element a("; maxi; ","; maxj; ")="; a(maxi, maxj)
IF maxi <> 1 THEN FOR j = 1 TO 4: SWAP a(maxi, j), a(1, j): NEXT
IF maxj <> 1 THEN FOR i = 1 TO 7: SWAP a(i, 1), a(i, maxj): NEXT
PRINT "novyj massiv"
FOR i = 1 TO 7
FOR j = 1 TO 4
PRINT a(i, j);
NEXT
PRINT
NEXT
Тестирование выполнено в программе QB64 ( Скачать )