# Code on matrix multiplication

Can someone help me write a code that can multiply a matrix

In what programming language should the matrix multiplication code be written?

The programming language is Qbasic

Hey @promisechi!

You might want to look at bounties to get people to make code for you.

1 Like

Well, you can try below code for multiply a matrix.

``````DIM A(3, 3), B(3, 3), C(3, 3)

' Input values for matrix A
PRINT "Enter values for matrix A:"
FOR i = 1 TO 3
FOR j = 1 TO 3
INPUT "A(" + STR\$(i) + "," + STR\$(j) + "): ", A(i, j)
NEXT j
NEXT i

' Input values for matrix B
PRINT "Enter values for matrix B:"
FOR i = 1 TO 3
FOR j = 1 TO 3
INPUT "B(" + STR\$(i) + "," + STR\$(j) + "): ", B(i, j)
NEXT j
NEXT i

' Multiply matrices A and B to get matrix C
FOR i = 1 TO 3
FOR j = 1 TO 3
C(i, j) = 0
FOR k = 1 TO 3
C(i, j) = C(i, j) + A(i, k) * B(k, j)
NEXT k
NEXT j
NEXT i

' Display the result matrix C
PRINT "Resulting matrix C:"
FOR i = 1 TO 3
FOR j = 1 TO 3
PRINT C(i, j);
NEXT j
PRINT
NEXT i

END
``````

Thanks