Monday, 3 December 2012

Matrix Addition



  Matrix addition is performed by adding the corresponding elements of two or more matrices. Here I have provided a Program which can be used to add two Matrices. Matrix addition is possible only if both the matrices have the same order.  If the order of the first Matrix is 2 X 3 and the order of the second Matrix is 3 X 4, then the two Matrices can't be added. The Time complexity of Matrix addition is O(n2). 

                                                 Consider the two matrices given below.


                     Matrix 1                                                                                 Matrix 2

        11       22         33                                                                      1           2              3

        44       55         66                                                                     4            5             6

        77       88         99                                                                     7            8             9


                                                       The Sum Matrix is given below

                                                          12              24               36

                                                          48              60               72

                                                          84              96              108


Click here to download the C Program to perform Matrix Addition.
Click here to download the C++ Program to perform Matrix Addition.


No comments:

Post a Comment