Program to calculate the addition of 2 matricesExplanationIn this program, we need to add two matrices and print the resulting matrix. Matrix:Matrix is a rectangular two-dimensional array of numbers arranged in rows and columns. A matrix with m rows and n columns can be called as m � n matrix. Individual entries in the matrix are called element and can be represented by aij which suggests that the element a is present in the ith row and jth column. Addition of two matrices:Two matrices A and B can be added if and only if they have same dimensions that are, the same number of rows and columns. It is not possible to add a 2 � 3 matrix with a 3 � 2 matrix. Addition of two matrices can be performed by adding their corresponding elements as (A + B)ij= Aij + Bij Addition of two matrices can be performed by looping through the first and second matrix. Add the corresponding elements of both matrices and store the result in the third matrix. Algorithm
SolutionPythonOutput: Addition of two matrices: 2 1 2 6 8 7 2 7 4 COutput: Addition of two matrices: 2 1 2 6 8 7 2 7 4 JAVAOutput: Addition of two matrices: 2 1 2 6 8 7 2 7 4 C#Output: Addition of two matrices: 2 1 2 6 8 7 2 7 4 PHPOutput: Addition of two matrices: 2 1 2 6 8 7 2 7 4 Next Topic# |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India