Advertisement
myloyo

6.1.6 статически

Nov 28th, 2022 (edited)
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.53 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. #include <algorithm>
  4. #include <cmath>
  5.  
  6. using namespace std;
  7.  
  8. int main()
  9. {
  10.     int n, s1;
  11.     cin >> n;
  12.     s1 = 0;
  13.     int a[101];                        
  14.     for (int i = 0; i < n; i++) {
  15.         cin >> a[i];
  16.         s1 += a[i];
  17.     }
  18.     cout << (double)s1 / n << endl;
  19.     int k, m, s2;
  20.     cin >> k >> m;
  21.     s2 = 0;
  22.     int b[101][101];                      
  23.     for (int i = 0; i < k; i++) {
  24.         for (int j = 0; j < m; j++) {
  25.             cin >> b[i][j];
  26.             s2 += b[i][j];
  27.  
  28.         }
  29.     }
  30.     cout << (double)s2 / (k * m);
  31.     return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement