Previous Next
0 / 21
Module DEMO-32-109DEMO-C-32

Row Sums

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program to calculate the sum of elements for each row in an N x M matrix. Print N integers separated by space.

Constraints

1 <= N, M <= 10. Integers within standard range.

Input Format

Input: Dimensions N M followed by the matrix elements.

Output Format

Output: The formatted result as specified.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
2 4
20 25 25 2
29 13 24 10
72 76
Row sums: 72, 76.
Sample #2
Public sample
5 5
41 19 35 10 39
35 5 30 35 37
7 41 43 12 29
19 10 48 41 14
25 40 32 49 37
144 142 132 132 183
Row sums: 144, 142, 132, 132, 183.
Sample #3
Public sample
5 2
4 -2
4 22
47 14
32 50
19 -4
2 26 61 82 15
Row sums: 2, 26, 61, 82, 15.
Sample #4
Public sample
2 2
15 21
27 30
36 57
Row sums: 36, 57.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings