#include using namespace std; int main() { int cnt = 0, // Count of numbers read. tot = 0; // Total of numbers read. int num; // Input number. // Read until a read fails. while(cin >> num) { tot += num; ++cnt; } /* Print the average. */ if(cnt) cout << "Average is " << (double)tot / (double)cnt << endl; else cout << "No numbers." << endl; }