P = 1
FOR i = 1 TO n
IF a(i) > 0 THEN P = P * a(i) ELSE s = s + a(i)
NEXT
PRINT P
PRINT s
следующий вариант
INPUT "vvedite kol-vo strok ", m
INPUT "vvedite kol-vo stolbcov ", n
DIM a(m, n)
RANDOMIZE TIMER
FOR i = 1 TO m
FOR j = 1 TO n
a(i, j) = INT(RND * 10) - 5
NEXT
NEXT
PRINT "matrica"
FOR i = 1 TO m
FOR j = 1 TO n
PRINT a(i, j);
NEXT
PRINT
NEXT
p = 1
FOR i = 1 TO m
FOR j = 1 TO n
IF a(i, j) > 0 THEN p = p * a(i, j) ELSE s = s + a(i, j)
NEXT
NEXT
PRINT p
PRINT s
Тестирование выполнено в программе QB64 ( Скачать )