![]() |
VOOZH | about |
Here, we will see how to check whether two matrices are equal or not using a C Program
Input:
First Matrix: 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 Second matrix: 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4 1, 2, 3, 4
Output:
Matrices are equal.
For any two matrices to be equal, the number of rows and columns in both the matrices should be equal and the corresponding elements also equal.
Example:
First Matrix 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Second Matrix 1 2 3 4 1 2 3 4 1 2 3 4 1 2 3 4 Matrices are equal
Time complexity: O(n2).
Auxiliary space: O(1).