Trying to figure out adding in a sequence.

I have a question on some work I have to do, and I'm completely lost. I have to use the while/for structures to create a program that pretty much does the following. Asks for two numbers... say 1 and 5. Then the program sums up 1+2+3+4+5. Thanks for helpful input in advance.
If you use a while loop, your program can do something along these lines -
1
2
3
4
5
6
7
8
cin >> 2 numbers
{
     while (number 1 <= number 2)
     {
          result += number 1;
          number 1++;
     }
}
if you want to use a for loop:

1
2
3
4
5
6
cin >> 2 numbers

      for (int i = number1; i<= number2; i++)
      {
             result +=i;
      }
Thanks, I was hoping it wasn't too complex, as I'm still a beginner lol.
Topic archived. No new replies allowed.