Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main (void)
- {
- int sum = 0;
- int counter = 0;
- counter++;
- int input = 0;
- cout << "Enter in a series of numbers in order to find the average." << endl;
- cout << "Entering a negative number will stop the series." << endl;
- do
- {
- cin >> input;
- sum += input;
- }
- while(input >=0);
- cout << "The average is: " << sum/counter << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement