Advertisement
mariusqw

Untitled

Apr 2nd, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.  
  7. int n;
  8. cout << "Iveskite kamuoliuku skaiciu: "; cin >> n;
  9.  
  10. int ballCountSum = 0;
  11. for(int i = 1; i <= n; i++) {
  12. int ballPoint;
  13. cout << i << "-o kamuoliuko tasku kiekis: "; cin >> ballPoint;
  14. ballCountSum += ballPoint;
  15. }
  16.  
  17. double ballsAverage = (double)ballCountSum / n;
  18.  
  19. cout << "Is viso buvo galima surinkti tasku: " << n * 6 << endl;
  20. cout << "Tomas is viso surinko " << ballCountSum << " tasku" << endl;
  21. cout << "Jo tasku vidurkis: " << ballsAverage << " tasko" << endl;
  22.  
  23. string wonType = (ballCountSum > (n * 6) / 2) ? "laimeta" : "pralaimeta";
  24.  
  25. cout << "Loterija " << wonType << endl;
  26.  
  27. return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement