CLS
INPUT "Vvedite kovo strok="; n
INPUT "Vvedite kolvo stolbcov="; m
DIM a(n, m)
RANDOMIZE TIMER
FOR i = 1 TO n
FOR j = 1 TO m
a(i, j) = INT(RND * 101) - 50
NEXT j
NEXT i
PRINT "Matrica A"
FOR i = 1 TO n
FOR j = 1 TO m
PRINT a(i, j);
NEXT j
PRINT
NEXT i
PRINT
FOR j = 1 TO m
s = 0: k = 0
FOR i = 1 TO n
IF a(i, j) < 0 THEN s = s + a(i, j): k = k + 1
NEXT i
IF k > 0 THEN
s = s / n
PRINT "Sredneye znacheniye otricat elementov stolbca #"; j; "="; s
ELSE
PRINT "V stolbce #"; j; "net otricat elementov"
END IF
NEXT j
END
Тестирование выполнено в программе QB64 ( Скачать )