Skip to content

arnab132/Matrix-Multiplication-With-User-Input-Python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 

Repository files navigation

Matrix Multiplication With User Input Using Python

Given two user input matrix. Our task is to Display the addition of two matrix. In these problem we use nested List comprehensive.

Algorithm

Step1: Input two matrix from the User.

Step 2: Nested for loops to iterate through each row and each column.

Step 3: Take one resultant matrix which is initially contains all 0.

Step 4: Then we multiply each row elements of first matrix with each elements of Second matrix, then add all multiplied value. That is the value of resultant matrix.

Sample Output

Enter N for N x N matrix: 3

Enter the element ::>

2 1 4 2 1 2 3 4 3

[[2, 1, 4], [2, 1, 2], [3, 4, 3]]

Display Array In Matrix Form:

2 1 4 2 1 2 3 4 3

Enter N for N x N matrix : 3

Enter the element ::>

1 2 3 4 5 6 7 8 9

[[1, 2, 3], [4, 5, 6], [7, 8, 9]]

Display Array In Matrix Form

1 2 3 4 5 6 7 8 9

The Resultant Matrix Is ::>

[34, 41, 48] [20, 25, 30] [40, 50, 60]