Advertisement
Guest User

Untitled

a guest
Jun 29th, 2012
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main (void)
  5. {
  6. int sum = 0;
  7. int counter = 0;
  8. counter++;
  9. int input = 0;
  10. cout << "Enter in a series of numbers in order to find the average." << endl;
  11. cout << "Entering a negative number will stop the series." << endl;
  12.  
  13. do
  14. {
  15. cin >> input;
  16. sum += input;
  17. }
  18. while(input >=0);
  19.  
  20. cout << "The average is: " << sum/counter << endl;
  21.  
  22.  
  23. return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement