The purpose of this program is to display the sums of all of the numbers from one to the input number. Example if i enter 5 i want it to add the numbers 1+2+3+4+5 = 15 or if i enter 225 it will add 1+2+.....225
Here is what i am working with
insertIt works fine when i go in order 1+2+3+.....10 but it does not add all i need.Code:#include <iostream.h> void main() { int Number, Sum; Sum = 0; cout << "Enter a number: " << endl; cin >> Number; while (Number >= 0) { Sum = Sum + Number; cout << "Current Total " << Sum << endl; cout << "Enter a number: " << endl; cin >> Number; } cout << "The total is " << Sum << endl; }
Any hints will help thanks in advance.