Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- double x[5];
- int m[5];
- double multiplictions[5];
- double sum = 0.0;
- int mSum = 0;
- double averageValue = 0.0;
- for (int i = 0; i < 5; ++i)
- {
- cin >> x[i] >> m[i];
- multiplictions[i] = x[i] * m[i];
- mSum += m[i];
- sum += multiplictions[i];
- }
- averageValue = sum / 5.0;
- cout << mSum << " " << averageValue << endl;
- return 0;
- }
- /*
- 0.5 34
- 0.233 8
- 0.2 39
- 0.87 1
- 0.98322 9
- 91 7.2766
- 0.625 17
- 0.133333 15
- 0.272727 9
- 0.142857 7
- 0.8 3
- 51 3.69591
- 0.1875 2
- 0.571429 18
- 0.75 11
- 0.409091 4
- 0.6 9
- 44 5.18942
- 0.5 8
- 0.727273 15
- 0.166667 11
- 0.9 18
- 0.846154 11
- 63 8.45003
- 0.5 13
- 0.434783 2
- 0.95 12
- 0.73913 15
- 0.764706 19
- 61 8.87719
- 0.928571 13
- 0.722222 6
- 0.545455 18
- 0.25 5
- 0.8 18
- 60 8.37459
- 0.285714 9
- 0.888889 19
- 0.375 14
- 0.409091 0
- 0.833333 9
- 51 6.44206
- 0.5 2
- 0.541667 8
- 0.375 14
- 0.4 18
- 0.833333 14
- 56 5.89
- 0.181818 11
- 0.555556 6
- 0.5 19
- 0.888889 11
- 0.636364 11
- 58 6.32222
- 0.875 2
- 0.636364 18
- 0.846154 19
- 0.4 13
- 0.538462 13
- 65 8.29629
- 0.25 19
- 0.05 13
- 0.461538 5
- 0.875 13
- 0.2 16
- 66 4.45654
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement