السابق التالي
0 / 21
الوحدة النمطية DEMO-32-109DEMO-C-32

Add Matrices

DEMO-C-32 • Programming in C

Browser-only practice

بيان المشكلة

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.

قيود

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

تنسيق الإدخال

Input: Dimensions N M followed by the matrix elements.

تنسيق الإخراج

Output: The formatted result as specified.

حالات اختبار نموذجية

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

العينة رقم 1
عينة ظاهرة
2 3
7 3 2
1 6 3
7 3 6
3 5 7
14 6 8
4 11 10
Performed element-wise addition.
العينة رقم 2
عينة ظاهرة
3 2
7 2
9 2
4 9
4 6
2 5
6 9
11 8
11 7
10 18
Performed element-wise addition.
العينة رقم 3
عينة ظاهرة
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.
العينة رقم 4
عينة ظاهرة
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
إعدادات المحرر