// Find total, count, print average #include using namespace std; int main() { int count=0, total=0, num, small, large; cout<<"Enter number: "; cin>>num; // read first number small=large=num; //first num is smallest & largest so far. while (num>=0) { total+=num; count++; if (num < small) small = num; // store new smallest if (num > large) large = num; // store new largest cout<<"Enter number (-1 to end): "; cin>>num; // read next number } // while cout<<"Total = "< 0) // avoid dividing by zero! { cout<<"Average = "<<1.0*total/count<<"\n"; cout<<"The numbers range from "<