Sum of elements in a matrix
Submissions: 4258   Accuracy:

42.5%

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

Given a non null integer matrix,calculate the sum of its elements.

Input: First line contains T , the number of test cases.First line of each test contains 2 integers N,M and N lines follow which contain M spaced integers.

Output:Single line for each test case containing the sum

Constraints: 1<= N,M<=10,  -1000<=elements of matrix<=1000

Example:
Input:
1

2 3 
1 0 0
8 -9 -1

Output 

-1

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

Contributor: Yash Kodesia
Author: Yash Kodesia 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.