Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- #include <ctype.h>
- int main() {
- int n;
- scanf("%d", &n);
- int mat[n][n];
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < n; j++) {
- scanf("%d", &mat[i][j]);
- }
- }
- int posleden_element = mat[n - 1][n - 1];
- int b[n][n];
- b[0][0] = posleden_element;
- int x = 0, y = 1;
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < n; j++) {
- b[x][y] = mat[i][j];
- y++;
- if(y >= n) {
- y = 0;
- x++;
- }
- if(x >= n) {
- break;
- }
- }
- }
- for(int i = 0; i < n; i++) {
- for(int j = 0; j < n; j++) {
- printf("%d ", b[i][j]);
- }
- printf("\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement