MS DOS QBasic 1,0
DIM m AS INTEGER, n AS INTEGER
CLS
INPUT "M,N = ", m, n
REDIM a(1 TO m, 1 TO n) AS INTEGER
RANDOMIZE TIMER
FOR i = 1 TO m
FOR j = 1 TO n
a(i, j) = 100 * RND - 50
PRINT USING "####"; a(i, j);
NEXT j
PRINT
NEXT i
min = 1000: max = -1000
FOR i = 1 TO m
FOR j = 1 TO n
IF a(i, j) > max THEN
max = a(i, j)
jmax = j
END IF
IF a(i, j) < min THEN
min = a(i, j)
jmin = j
END IF
NEXT j
NEXT i
DIM p AS DOUBLE
p = 1
FOR i = 1 TO m
p = p * a(i, jmax) * a(i, jmin)
NEXT i
PRINT "P="; p
Пример
M,N = 4,7
11 42 -35 -8 -11 -40 -23
-16 -45 -41 13 0 -41 22
32 48 29 -10 15 -38 22
27 -22 -23 -9 7 2 30
P= 3983377305600