The below program subtracts of two square matrices of size 4*4, we can change N for different dimension.
Result matrix is 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
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
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Program for addition of two matrices
- Program to check if two given matrices are identical
- Python program to add two Matrices
- Python program to multiply two matrices
- Python List Equality | Program to check if two given matrices are identical
- Java Program to Multiply two Matrices of any size
- Java Program to Add two Matrices
- Program to concatenate two given Matrices of same size
- Program to multiply two matrices
- Addition and Subtraction of Matrix using pthreads
- Subtraction of two large numbers using 9's compliment
- Subtraction of two large numbers using 10's compliment
- Subtraction of two numbers using 2's Complement
- Multiplication of two Matrices in Single line using Numpy in Python
- Count sub-matrices having sum divisible 'k'
- Kronecker Product of two matrices
- A square matrix as sum of symmetric and skew-symmetric matrices
- Count pairs from two sorted matrices with given sum
- Different Operations on Matrices
- Queries on number of Binary sub-matrices of Given size