i am getting 8.66 as my answer but i am suppose to get 8.33.
input 10 30 -15 0
not sure where my error is. can you help me please.
// This program is suppose to count the integers than average them.
// with zero being the end input.
using namespace std;
int num = 1; // the integers entered by the user
int amt = 0; // amount of numbers entered
float sum = 1; // the amount of numbers added and new sum after adding number
double avg; // the average of all the numbers
// display the while statement
while (num != 0)
cout << "Get a integer from the user.\n";
cin >> num;
sum = sum + num;
// the equation for the average
avg = sum /(amt-1);
cout << " You have entered " << amt << " numbers.";
cout << " The average is " << avg << endl;