Add a list of integer from keyboard
Source Code:
Result:
Source Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #include <iostream.h> #include <conio.h> using namespace std; int main () { int x; int sum = 0; cout << " Enter your number: <EOF> to stop \n"; while (cin >> x) sum += x; cout << "\n The total number: " << sum << endl; getch (); return 0; } // main |
Result:
Enter your number: <EOP> to stop 15 22 3^d The total is: 40