Wednesday, November 1, 2017

Ex.No 9 Multiply Matrices



Aim
            To write a python program to multiply two matrices
Algorithm
·

Step1:Start
Step2:Read Matrix A and Matrix B
Step2:To multiply two matrices, sufficient and necessary condition is
Step2.1:Number of coloumns in matrix A = number of rows  in matrix B
     Step3:Loop for each row in matrix A
    Step4:Loop for each columns in matrix B and initialize output matrix C to 0. This loop will    
              run for each rows of matrix A
    Step5:Loop for each columns in matrix A
   Step6:Multiply A[i,k] to B[k,j] and add this value to C[i,j]
   Step7:Print matrix C
   Step8:Stop


No comments:

Post a Comment