DIM m AS INTEGER
CLS
INPUT "m=", m
DIM a(1 TO m, 1 TO m) AS INTEGER
RANDOMIZE TIMER
FOR i = 1 TO m
FOR j = 1 TO m
a(i, j) = 50 * RND - 25
PRINT USING "####"; a(i, j);
NEXT j
PRINT
NEXT i
DIM P AS DOUBLE, S AS INTEGER
DIM B(1 TO m) AS DOUBLE
P = 1
FOR i = 1 TO m
S = 0
FOR j = 1 TO m
IF a(i, j) > 0 THEN P = P * a(i, j)
S = S + a(i, j)
NEXT j
B(i) = S / m
NEXT i
PRINT "P="; P
PRINT "Vector"
FOR i = 1 TO m
PRINT USING "###.#####"; B(i)
NEXT i
Пример
m=5
3 -12 -2 -3 -4
11 -13 21 20 14
21 5 18 -20 -1
-3 24 -24 -19 8
-14 -24 -7 -2 -3
P= 70413235200
Vector
-3.60000
10.60000
4.60000
-2.80000
-10.00000