So far, what i'm trying to do is find the sum of the integer i entered. so for example, i enter 5 the result will show 15. Actually, that is my problem because instead of the result showing 15 it shows 5 as the result. I know its adding 1 to each value so it shows 12345. what i want is 1+2+3+4, but my math formula is wrong. To make this work i have another formula to try and that is n= number. (n(n+1)/2. If i use this formula it doesn't work.

// Sum of Numbers // This ogram uses a loop to get the sum of all integers // from 1 up to the number entered. #include <iostream> using namespace std; int main() { int number; int num = 1; int sum = 0; cout << “Enter a Positive Integer: “ << endl; cin >> number; while(number <1) { cout << “ The number must be a postive integer: “ << endl; cin >> “ number; } [b]for ( sum = 1; sum <= number; sum++) { sum += number[/b] } cout << “The sum of the number is: “ << endl; return 0; }

This post has been edited by **Martyr2**: 24 October 2010 - 01:49 PM

Reason for edit:: Please use code tags in the future, thanks!