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

Rotate 180

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program to rotate a matrix 180 degrees.

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
15 5 -10 45
45 18 37 33
16 26 49 8
23 3 34 -7
-7 34 3 23
8 49 26 16
33 37 18 45
45 -10 5 15
Rotated 180 degrees (flipped).
Sample #2
Public sample
2 5
7 48 5 -7 13
41 7 3 -4 -3
-3 -4 3 7 41
13 -7 5 48 7
Rotated 180 degrees (flipped).
Sample #3
Public sample
4 4
44 12 22 18
-8 11 2 25
26 19 19 36
48 -8 15 46
46 15 -8 48
36 19 19 26
25 2 11 -8
18 22 12 44
Rotated 180 degrees (flipped).
Sample #4
Public sample
2 5
17 24 31 32 9
23 8 9 8 22
22 8 9 8 23
9 32 31 24 17
Rotated 180 degrees (flipped).

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