// Find total, count, print average while 'Y' loop #include using namespace std; int main() { int count=0, total=0, num; char answer='Y'; cout<<"Are there any numbers (Y or N):"; cin>>answer; while (answer=='Y' || answer=='y') //accept either Y or y { cout<<"Enter number: "; cin>>num; // read next number total+=num; count++; cin.ignore(100,'\n'); //flush the \n from the buffer cout<<"Are there more numbers (Y or N):"; cin>>answer; } // while cout<<"Total = "< 0) // avoid dividing by zero! cout<<"Average = "<<1.0*total/count<<"\n"; return 0; } // main