Algorithm // Addition of Matrices: Pseudocode
Algorithm // Addition of Matrices: Pseudocode
Algorithm // Addition of Matrices: Pseudocode
Algorithm // Multiplication
o STEP 1: START
o STEP 2: DEFINE row1, col1, row2, col2
o STEP 3: INITIALIZE matrix a[][] ={{1,3,2},{3,1,1}, {1,2,2}}
o STEP 4: INITIALIZE matrix b[][] ={{2,1,1},{1,0,1}, {1,3,1}}
o STEP 5: row1 = a.length
o STEP 6: col1 = a[0].length
o STEP 7: row2 =b.length
o STEP 8: row2 = b[0].length
o STEP 9: if(col1!=row2)
PRINT "Matrices cannot be multiplied"
else
Go to step 10;
o STEP 10: prod[][] = [row1][col2]
o STEP 11: REPEAT STEP 12 to STEP 14 UNTIL i<row1
//for(i=0; i<row1; i++)
o STEP 12: REPEAT STEP 13 to STEP 14 UNTIL j<col2 // for(j=0; j<col2; j++)
If(j>i) then PRINT 0 else PRINT a[i][j]
o STEP 13: REPEAT STEP 14 UNTIL k<row2 // for(k=0; k<row2; k++)
o STEP 14: prod[i][j] = prod[i][j] + a[i][k]*b[k][j]
o STEP 15: REPEAT STEP 16 to STEP 18 UNTIL i<row1
o STEP 16: REPEAT STEP 17 UNTIL j<col2
o STEP 17: PRINT prod[i][j]
o STEP 18: PRINT new line
o STEP 19: END
Flowchart