The program below computes the product of two 3 by 3 matrices using the Pascal programming language.

3x3 Matrix Program Pascal solution
Sample Program
You can modify the program if you like. Some ideas are:

  1. Modify the program using Functions/Procedures.
  2. Modify the program such that it can compute the product for any size of two matrices provided the number of columns of first matrix is equal to the number of rows of the second matrix.

3 Comments

  1. Hi Tom. I just rechecked the program and got the same answer as before. You can view the screenshot here – http://goo.gl/d06oNH I guess the problem is your input. Check! In this case, when prompted to enter the elements for matrix A, type 1 then press ENTER, type 2 and press ENTER, to 9. For matrix B, type 9 then press ENTER, type 8 and press ENTER, to 1. I also solved the problem manually on paper just to make sure it was correct. Also check your code.

  2. When I do the multiplication, I get
    [30 23 19 ]
    [84 65 58 ]
    [138 107 97 ]
    What could be going on that my calculation is close but differs from yours?

Write A Comment