CLS
INPUT "kolvo strok="; n
INPUT "kolvo stolbcov="; m
DIM a(n, m)
RANDOMIZE TIMER
FOR i = 1 TO n
FOR j = 1 TO m
a(i, j) = INT(RND * 100) - 50
NEXT j
NEXT i
FOR i = 1 TO n
FOR j = 1 TO m
PRINT a(i, j);
NEXT j
PRINT
NEXT i
PRINT
s = 0: k = 0
FOR i = 1 TO n
FOR j = 1 TO m
IF a(i, j) > 0 THEN s = s + a(i, j): k = k + 1
NEXT j
NEXT i
IF k > 0 THEN
c = s / k
PRINT "Srednee arifm polozh elementov="; c
ELSE
PRINT "V massive net polozh elementov"
END IF
END
Тестирование выполнено в программе QB64 ( Скачать )