# include # include using namespace std; int main ( ) // // SUM_COUNTER allows the user to enter a sequence of numbers which // are added up by the program, and the result printed. // // The user must first tell the program the number of values to be added. // { int n, step; float sum, x; cout << "Enter N, the number of values to add: "; cin >> n; sum = 0.0; step = 0; while ( step < n ) { // // Increase the loop counter. // step = step + 1; cin >> x; sum = sum + x; } cout << "Sum of " << n << " numbers is " << sum << "\n"; return 0; }