Advertisement
Josif_tepe

Untitled

May 20th, 2021
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main() {
  5.     int n, m;
  6.     scanf("%d%d", &n, &m);
  7.    
  8.     int matrica[n][m];
  9.    
  10.     for(int i = 0; i < n; i++) {
  11.         for(int j = 0; j < m; j++) {
  12.             scanf("%d", &matrica[i][j]);
  13.         }
  14.     }
  15.     int najmal_zbir = 2000000000; // 2 milijardi(bilioni)
  16.     int indeks = -1;
  17.     for(int j = 0; j < m; j++) {
  18.         int zbir = 0;
  19.         for(int i = 0; i < n; i++) {
  20.             zbir += matrica[i][j];
  21.         }
  22.         if(zbir < najmal_zbir) {
  23.             najmal_zbir = zbir;
  24.             indeks = j;
  25.         }
  26.     }
  27.     printf("%d\n", indeks + 1);
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement