'QB
INPUT "Input number of rows: ",N
INPUT "Input number of cols: ",M
DIM Arr(1 TO N, 1 TO M)
max = 0
max_i = 0
RANDOMIZE TIMER
FOR i = 1 TO N
x = 0
FOR j = 1 TO M
Arr(i, j) = FIX(RND * 101) - 50
x = x + Arr(i, j)
NEXT
x = x / M
IF x > max THEN
max = x
max_i = i
END IF
NEXT
PRINT "Maximal middle value " + STR$(max) + " is in line #" + STR$(max_i)