#include
/*
void main () {
int num, count = 1;
float sum = 0.0;
cout << endl;
while (count <= 3) {
cout << "Enter a number: ";
cin >> num;
sum = sum + num;
count = count + 1;
}
cout << "Average is " << sum / count << endl;
}
// Try entering 8, 8, 8 ==> average is 6 which is bogus
There are several ways of fixing the problem. Here is one of them:
*/
void main () {
int num, count = 1;
float sum = 0.0;
cout << endl;
while (count <= 3) {
cout << "Enter a number: ";
cin >> num;
sum = sum + num;
count = count + 1;
}
cout << "Average is " << sum / (count - 1) << endl;
}