Advertisement
Josif_tepe

Untitled

Dec 26th, 2022
1,209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4. #include <ctype.h>
  5.  
  6. int main(int argc, const char * argv[]) {
  7.     int red, kolona;
  8.     scanf("%d%d", &red, &kolona);
  9.    
  10.     int mat[red][kolona];
  11.     for(int i = 0; i < red; i++) {
  12.         for(int j = 0; j < kolona; j++) {
  13.             scanf("%d", &mat[i][j]);
  14.         }
  15.     }
  16.    
  17.     for(int i = 0; i < red / 2; i++) {
  18.         for(int j = 0; j < kolona; j++) {
  19.             int pomosna = mat[i][j];
  20.             mat[i][j] = mat[red - 1 - i][j];
  21.             mat[red - 1 - i][j] = pomosna;
  22.         }
  23.     }
  24.    
  25.     for(int i = 0; i < red; i++) {
  26.         for(int j = 0; j < kolona; j++) {
  27.             printf("%d ", mat[i][j]);
  28.         }
  29.         printf("\n");
  30.     }
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement