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

Add Matrices

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program to add two matrices of the same dimensions. Input consists of dimensions R C, followed by elements of Matrix A, then Matrix B.

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 3
7 3 2
1 6 3
7 3 6
3 5 7
14 6 8
4 11 10
Performed element-wise addition.
Sample #2
Public sample
3 2
7 2
9 2
4 9
4 6
2 5
6 9
11 8
11 7
10 18
Performed element-wise addition.
Sample #3
Public sample
4 3
3 7 2
8 1 5
1 2 0
1 6 6
3 4 8
6 1 6
0 6 5
0 7 7
6 11 10
14 2 11
1 8 5
1 13 13
Performed element-wise addition.
Sample #4
Public sample
3 3
4 2 0
8 2 5
6 8 3
8 8 2
4 6 6
9 2 1
12 10 2
12 8 11
15 10 4
Performed element-wise addition.

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