Advertisement
Josif_tepe

Untitled

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