Write a C++ console application to find the summation of two matrices. First, take the row and column numbers of two matrices. If the number of rows of first matrix is same to the number of rows of second matrix (same condition for column), we can add them. So, your program check this condition before taking the values of matrices. Declare two dimensional (2D) arrays to put the values of each matrix and add them in another 2D array.
Write a C++ console application to find the summation of two matrices. First, take the row and column numbers of two matrices. If the number of rows of first matrix is same to the number of rows of second matrix (same condition for column), we can add them. So, your
Sample Input:
Enter the rows and columns of first matrix: 3 4
Enter the rows and columns of second matrix: 2 4
Output
Rows and Columns are not same.
Enter the rows and columns of first matrix: 2 3
Enter the rows and columns of second matrix: 2 3
Enter first matrix:
2 5 6
3 7 9
Enter Second Matrix
5 10 12
11 7 19
The summation of two matrices is
7 15 18
14 14 28
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images