Josif_tepe

Untitled

Aug 28th, 2025
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <math.h>
  6. int main() {
  7.     int n, m;
  8.     scanf("%d%d", &n, &m);
  9.    
  10.     int mat[n][m];
  11.    
  12.     for(int i = 0; i < n; i++) {
  13.         for(int j = 0; j < m; j++) {
  14.             scanf("%d", &mat[i][j]);
  15.         }
  16.     }
  17.    
  18.    
  19.     for(int j = 0; j < m; j++) {
  20.         int sum = 0;
  21.        
  22.         for(int i = 0; i < n; i++) {
  23.             sum += mat[i][j];
  24.         }
  25.        
  26.         printf("%d\n", sum);
  27.     }
  28.    
  29.    
  30.     return 0;
  31. }
  32.  
  33. /*
  34.  8
  35.  1.3 0.7  7.0   2.5  3.3  14.9  5.1  2.24
  36.  **/
  37.  
Advertisement
Add Comment
Please, Sign In to add comment