Sunday 12 December 2010

Algorithm for To perform the addition and multiplication of wo matrices

Algorithm for To perform the addition and multiplication of two matrices

Description:


program takes the two matrixes of same size and performs the addition an also takes the two matrixes of different sizes and checks for possibility of multiplication and perform multiplication if possible.


algorithm:


Step 1: start
Step 2: read the size of matrices A,B – m,n
Step 3: read the elements of matrix A
Step 4: read the elements of matrix B

Step 5: select the choice for you want.
 If you select case 1 then goto matric addition.
 Else goto Step 7.
Step 6: print Sum of matrix A and B
Step 7: if you select case 2 then goto matrix multiplication
Step 8: check if n=p, if not print matrices can not be multiplied
           Step 9: Otherwise perform the multiplication of matrices

Step 10: Print the resultant matrix

Step 11: Stop

No comments:

Post a Comment