Ensure the number of columns in the first matrix equals the number of rows in the second matrix
Let the first matrix be A with size m × n
Let the second matrix be B with size n × p
Create a result matrix C with size m × p
For each row i in A
For each column j in B
Set C[i][j] = 0
For each k from 0 to n – 1
Multiply A[i][k] by B[k][j]
Add the product to C[i][j]
Repeat until all entries of C are filled
The entry C[i][j] is the dot product of row i of A and column j of B
