Advertisement
Josif_tepe

Untitled

Aug 23rd, 2023
925
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.52 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.    
  15.     for(int j = 0; j < m; j++) {
  16.         int zbir_na_kolona = 0;
  17.         for(int i = 0; i < n; i++) {
  18.             zbir_na_kolona += mat[i][j];
  19.         }
  20.         printf("%d\n", zbir_na_kolona);
  21.     }
  22.    
  23.     return 0;
  24.    
  25. }
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement