Advertisement
STANAANDREY

pb1 1/12/2021

Jan 12th, 2021
1,410
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4. int a[15][15], d[15], n;
  5. void citire(int & n, int a[15][15]) {
  6.   cin >> n;
  7.   for (int i = 1; i < n; i++)
  8.     a[i][i] = 0;
  9.   for (int i = 1; i < n; i++)
  10.     for (int j = i + 1; j <= n; j++) {
  11.       cout << "a[" << i << "][" << j << "]=";
  12.       cin >> a[i][j];
  13.       a[j][i] = a[i][j];
  14.     }
  15. }
  16. void grade(int n) {
  17.   for (int i = 1; i <= n; i++) {
  18.     d[i] = 0;
  19.     for (int j = 1; j <= n; j++)
  20.       d[i] += a[i][j];
  21.   }
  22. }
  23. void afisare_grade() {
  24.   for (int i = 1; i <= n; i++)
  25.     cout << d[i] << " ";
  26. }
  27. int main() {
  28.   citire(n, a);
  29.   grade(n);
  30.   afisare_grade();
  31.   return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement