Run Code
|
API
|
Code Wall
|
Users
|
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
Please
log in
to post a comment.
Largest and Second Largest number in an array
CO Assignment 1 Question 1
factorial
Sunday assignment v2
conditional expression
150108_recursividadFactorial
A_141124Burbuja
prime numbers using functions
2.3 Comparision with Matrix Multiplication Execution Time
Calculating longs v0.5 finish b next lab
Please log in to post a comment.