Advertisement
Josif_tepe

Untitled

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