CLS
INPUT "Vvedite kol-vo stolbcov:", xl
INPUT "Vvedite kol-vo strok:", yl
DIM X(xl, yl) AS INTEGER, Sum, el1, el2, Min, Max, NumStrok, NumStrok2
RANDOMIZE TIMER
' Zapolneniye matrici
FOR ix = 1 TO xl: FOR iy = 1 TO yl
X(ix, iy) = (RND * 101) - 50
NEXT: NEXT
' Summa maks elementa v stroke s min pervim elementom
' ishem stroku s min pervim elementom
Min = X(1, 1): Max = Min: NumStrok = 1: NumStrok2 = 1
FOR iy = 1 TO yl
IF X(1, iy) < Min THEN NumStrok = iy: Min = X(1, iy)
IF X(1, iy) > Max THEN NumStrok2 = iy: Max = X(1, iy)
NEXT
' ishem max element
el1 = X(1, NumStrok)
FOR ix = 1 TO xl
IF X(ix, NumStrok) > el1 THEN el1 = X(ix, NumStrok)
NEXT
' ishem min element
el2 = X(1, NumStrok2)
FOR ix = 1 TO xl
IF X(ix, NumStrok2) < el2 THEN el2 = X(ix, NumStrok2)
NEXT
Sum = el1 + el2
' Rezultat
PRINT "Matrica:"
FOR iy = 1 TO yl: FOR ix = 1 TO xl
PRINT X(ix, iy);
NEXT: PRINT: NEXT
PRINT "Summa:"; Sum
Тестирование выполнено в программе QB64 ( Скачать )