Addition of two square matrices
Submissions: 1599   Accuracy:

46.59%

  Difficulty: School   Marks: 0
*School Problem's Submission isn't counted in score!

Write a program to add two matrices.

Input
The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test contains an integer N denoting the size of the square matrix. Then the two square matrix of size N*N is taken as input in next two lines.

Output:
For each test case in a new line print separated values of the matrix denoting addition of the two matrices.

 

Constraints:
1<=T<=100
1<=N<=20
1<=a[i][j]<=1000

Example:
Input:

2
4
1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4
2
1 2 3 4
3 4 2 1

Output:
2 2 2 2 4 4 4 4 6 6 6 6 8 8 8 8 
4 6 5 5

** For More Input/Output Examples Use 'Expected Output' option **

Contributor: Ayush Govil
Author: Ayush Govil 1


If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.



Need help with your code? Please use ide.geeksforgeeks.org, generate link and share the link here.


to report an issue on this page.