Eminem - Billiards
Single File Programming Question
Problem Statement
Eminem is a billiard player who enjoys playing billiards and also likes solving mathematical puzzles. He notices that the billiard balls on the table are arranged in a grid, and he is curious to find the sum of the numbers written on each ball.
Write a program to find the sum of all the numbers written on each ball in the grid.
Input:
format :The first line of input consists of an integer N, representing the number of rows.
The second line consists of an integer M, representing the number of columns.
The following lines N lines consist of M space-separated integers, representing the numbers written on each ball.
Output:
format :The output prints an integer representing the sum of all the numbers written on each ball.
Refer to the sample output for the formatting specifications.
Code constraints :
1 ≤ M, N ≤ 10
Sample test cases :
Input 1:
3 3 1 2 3 4 5 6 7 8 9
Output 1:
45
Input 2:
3 2 11 2 12 3 13 4
Output 2:
45