Advertisement
LEGEND2004

Matrix

Jan 21st, 2024
1,075
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.47 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. #define int long long
  5.  
  6. signed main()
  7. {
  8.     int n , m;
  9.     cin >> n >> m; // matrix (2D massiv)-in olculeri
  10.     int a[n + 5][m + 5]; // matrixin goturulmesi
  11.     int sum = 0;
  12.     for(int i = 1; i <= n; i++){ // setirin nomresi (yuxaridan asagi)
  13.         for(int j = 1; j <= m; j++){ // sutunun nomresi (soldan saga)
  14.             cin >> a[i][j]; // yuxaridan i - ci setirde, soldan j - ci sutunde olan eded
  15.             sum += a[i][j];
  16.         }
  17.     }
  18.     cout << sum << endl;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement