The below program adds two square matrices of size 4*4, we can change N for different dimension.
Result matrix is 2 2 2 2 4 4 4 4 6 6 6 6 8 8 8 8
The program can be extended for rectangular matrices. The following post can be useful for extending this program.
How to pass a 2D array as a parameter in C?
The time complexity of the above program is O(n2).
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above
- Program to multiply two matrices
- C program for subtraction of matrices
- Python program to add two Matrices
- Python program to multiply two matrices
- Program to check if two given matrices are identical
- Python List Equality | Program to check if two given matrices are identical
- Addition of two number using '-' operator
- Addition and Subtraction of Matrix using pthreads
- Different Operations on Matrices
- Kronecker Product of two matrices
- Count sub-matrices having sum divisible 'k'
- Find the intersection of two Matrices
- Count pairs from two sorted matrices with given sum
- Count of matrices (of different orders) with given number of elements
- Minimum elements to be added so that two matrices can be multiplied
Improved By : Shivi_Aggarwal