Advertisement
meta1211

Untitled

Mar 27th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. int main()
  2. {
  3. int i = 0;
  4. int num = 1;
  5. int sum = 0;
  6. int avarage = 0;
  7. while (num != 0)
  8. {
  9. cin >> num;
  10. sum += num;
  11. i++;
  12. avarage += num;
  13. }
  14. if (i != 0)
  15. cout << sum << " " << avarage / i << endl;
  16. else
  17. cout << sum << " " << 0 << endl;
  18. return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement