DIM matr(1 TO 3, 1 TO 4) AS INTEGER
DIM sum AS INTEGER, summod AS INTEGER
CLS
RANDOMIZE TIMER
sum = 0
summod = 0
FOR i = 1 TO 3
FOR j = 1 TO 4
matr(i, j) = INT(RND * 100 - 50)
PRINT matr(i, j)
IF ABS(matr(i, j)) > 17 THEN
sum = matr(i, j) + sum
summod = ABS(matr(i, j)) + summod
END IF
NEXT j
NEXT i
PRINT
PRINT "Prosto summa: "; sum
PRINT "Summa po moduliu: "; summod
END
Тестирование выполнено в программе QB64 ( Скачать )