DECLARE SUB CalcResult
DECLARE FUNCTION CalcSum
CONST N = 3, M = 4
DIM SHARED A(1 To N, 1 TO M), B(1 To N, 1 TO M), C(1 To N, 1 TO M)
RANDOMIZE TIMER
FOR j = 1 TO M
FOR i = 1 TO N
A(i, j) = FIX(RND * 10)
B(i, j) = FIX(RND * 10)
NEXT
NEXT
CALL CalcResult
PRINT "Result matrix is:"
FOR j = 1 TO M
FOR i = 1 TO N
PRINT TAB(i * 8 - 7) C(i, j);
NEXT
PRINT
NEXT
PRINT
PRINT "Summ of matrix is: "; CalcSum
SUB CalcResult
FOR j = 1 TO M
FOR i = 1 TO N
C(i, j) = A(i, j) * B(i, j)
NEXT
NEXT
END SUB
FUNCTION CalcSum
RET = 0
FOR j = 1 TO M
FOR i = 1 TO N
RET = RET + C(i, j)
NEXT
NEXT
CalcSum = RET
END FUNCTION