Rotate a 4x4 array counter-clockwise for 90 degrees and then output it. Random Input of the original array data is required, 4 X degrees
// Rotate a 4x4 array counter-clockwise for 90 degrees and then output it. The original array data must be randomly input # include <stdio. h> int main () {int a [4] [4], B [4] [4], I, j; // a stores original array data, B stores the rotated array data printf ("please input 16 number:"); for (I = 0; I <4; I ++) for (j = 0; j <4; j ++) {scanf ("% d", & a [I] [j]); B [3-j] [I] = a [I] [j];} printf ("array B: \ n"); for (I = 0; I <4; I ++) {for (j = 0; j <4; j ++) printf ("% 6d", B [I] [j]); printf ("\ n");} return 0 ;}
Please input 16 number: 1 2 3 4 5 6 7 8 9 10 23 3 4 6 7 23 array B: 4 8 3 23 3 7 23 7 2 6 10 6 1 5 9 4 Press any key to continue
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.