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

Matrix Multiplication

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program to multiply two matrices A and B. Input dimensions are provided, assume valid multiplication dimensions. Print the resulting product matrix.

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
4 4
2 3 3 1
0 3 5 4
5 1 3 5
4 3 5 5
4 3 5 3
5 3 4 0
5 1 3 5
5 3 1 0
43 21 32 21
60 26 31 25
65 36 43 30
81 41 52 37
Multiplying two random matrices.
Sample #2
Public sample
4 4
3 2 0 0
1 4 5 0
4 3 1 3
1 3 5 2
1 3 2 0
4 4 1 2
3 5 4 0
2 0 5 1
11 17 8 4
32 44 26 8
25 29 30 9
32 40 35 8
Multiplying two random matrices.
Sample #3
Public sample
4 4
2 4 4 2
4 0 4 5
1 2 1 2
4 4 1 1
4 0 5 3
5 0 0 2
3 4 2 5
0 0 1 2
40 16 20 38
28 16 33 42
17 4 9 16
39 4 23 27
Multiplying two random matrices.
Sample #4
Public sample
2 2
1 4
0 3
0 3
4 5
16 23
12 15
Multiplying two random matrices.

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