Advertisement
Guest User

Untitled

a guest
Sep 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.24 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     double x[5];
  8.     int m[5];
  9.     double multiplictions[5];
  10.     double sum = 0.0;
  11.     int mSum = 0;
  12.     double averageValue = 0.0;
  13.     for (int i = 0; i < 5; ++i)
  14.     {
  15.         cin >> x[i] >> m[i];
  16.         multiplictions[i] = x[i] * m[i];
  17.         mSum += m[i];
  18.         sum += multiplictions[i];
  19.     }
  20.     averageValue = sum / 5.0;
  21.     cout << mSum << " " << averageValue << endl;
  22.     return 0;
  23. }
  24.  
  25. /*
  26.  
  27. 0.5 34
  28. 0.233 8
  29. 0.2 39
  30. 0.87 1
  31. 0.98322 9
  32.  
  33. 91 7.2766
  34.  
  35.  
  36. 0.625 17
  37. 0.133333 15
  38. 0.272727 9
  39. 0.142857 7
  40. 0.8 3
  41.  
  42. 51 3.69591
  43.  
  44.  
  45. 0.1875 2
  46. 0.571429 18
  47. 0.75 11
  48. 0.409091 4
  49. 0.6 9
  50.  
  51. 44 5.18942
  52.  
  53.  
  54. 0.5 8
  55. 0.727273 15
  56. 0.166667 11
  57. 0.9 18
  58. 0.846154 11
  59.  
  60. 63 8.45003
  61.  
  62.  
  63. 0.5 13
  64. 0.434783 2
  65. 0.95 12
  66. 0.73913 15
  67. 0.764706 19
  68.  
  69. 61 8.87719
  70.  
  71.  
  72. 0.928571 13
  73. 0.722222 6
  74. 0.545455 18
  75. 0.25 5
  76. 0.8 18
  77.  
  78. 60 8.37459
  79.  
  80.  
  81. 0.285714 9
  82. 0.888889 19
  83. 0.375 14
  84. 0.409091 0
  85. 0.833333 9
  86.  
  87. 51 6.44206
  88.  
  89.  
  90. 0.5 2
  91. 0.541667 8
  92. 0.375 14
  93. 0.4 18
  94. 0.833333 14
  95.  
  96. 56 5.89
  97.  
  98.  
  99. 0.181818 11
  100. 0.555556 6
  101. 0.5 19
  102. 0.888889 11
  103. 0.636364 11
  104.  
  105. 58 6.32222
  106.  
  107.  
  108. 0.875 2
  109. 0.636364 18
  110. 0.846154 19
  111. 0.4 13
  112. 0.538462 13
  113.  
  114. 65 8.29629
  115.  
  116.  
  117. 0.25 19
  118. 0.05 13
  119. 0.461538 5
  120. 0.875 13
  121. 0.2 16
  122.  
  123. 66 4.45654
  124.  
  125.  
  126. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement