Advertisement
Josif_tepe

Untitled

Apr 3rd, 2024
604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.45 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main() {
  4.     int red, kolona;
  5.     scanf("%d%d", &red, &kolona);
  6.  
  7.     int mat[red][kolona];
  8.  
  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 sum = 0;
  17.         for(int i = 0; i < red; i++) {
  18.             sum += mat[i][j];
  19.         }
  20.         printf("%d ", sum);
  21.     }
  22.    
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement