Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Matrix rotation 90-degree
#include <stdio.h> #define EDGE 5 int main (void) { int matrix[][EDGE] = {{1, 2, 3, 4, 5}, {5, 6, 7, 8,9}, {9, 10, 11, 12,13}, {13, 14, 15, 16,17},{17,18,19,20,21}}; int temp[EDGE][EDGE]; int i = 0, j = 0, t = 0; for (i = 0; i < EDGE; ++i) { for (j = 0; j < EDGE; ++j) printf ("[%3d] ", matrix[i][j]); puts (""); } for (i = EDGE - 1; i >= 0; --i) { for (j = 0; j < EDGE; ++j) temp[j][t] = matrix[i][j]; ++t; } puts (""); for (i = 0; i < EDGE; ++i) { for (j = 0; j < EDGE; ++j) printf ("[%3d] ", temp[i][j]); puts (""); } }
run
|
edit
|
history
|
help
2
Witout goto
Max successs
Star1..3
Greeting
asdfs
Lab 9 v0.96
Project 3 Part 1 v0.5
150109_RecursividadFactorial
150114_MatrizSumaPerimetro
h