1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-11-27 14:36:19 +00:00
202401-programming-assignments/【实践课外】8.数组2/7-6 方阵循环右移.c

30 lines
485 B
C
Raw Normal View History

2024-11-13 03:09:36 +00:00
#include <stdio.h>
int m, n, mat[10][10];
int main() {
scanf("%d%d", &m, &n);
m %= n;
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
scanf("%d", &mat[i][j]);
}
}
for (int i = 0; i < n; i++) {
for (int j = n - m; j < n; j++) {
printf("%d ", mat[i][j]);
}
for (int j = 0; j < n - m; j++) {
printf("%d ", mat[i][j]);
}
printf("\n");
}
return 0;
}