INPUT N
INPUT M
DIM A(N, M)
FOR i = 1 TO N
FOR J = 1 TO M
INPUT A(i, J)
NEXT J
NEXT i
FOR i = 1 TO N
FOR J = 1 TO M
IF A(i, J) <> 0 THEN S = S + A(i, J)
NEXT J
NEXT i
PRINT "s="; S
END
Тестирование выполнено в программе QB64 ( Скачать )