![]() |
VOOZH | about |
Given two matrices A and B of the same size, the task is to add them in Java.
Examples:
Input: A[][] = {{1, 2}, {3, 4}} B[][] = {{1, 1}, {1, 1}} Output: {{2, 3}, {4, 5}} Input: A[][] = {{2, 4}, {3, 4}} B[][] = {{1, 2}, {1, 3}} Output: {{3, 6}, {4, 7}}
Follow the Steps to Add Two Matrices in Java as mentioned below:
Below is the implementation of the above approach:
Resultant Matrix: 2 3 4 5