### Problem with for loop exercise

I'm trying to work through some exercises on for loops and I'm stuck on this one:

Write a program that takes two integers (one lower and one higher) and report the sum of all integers in between, including the two integers. For example, if 2 and 9 are entered the sum of all the integers is 44.

 ``12345678910`` ``````\\Getting the numbers - easy enough cout << "Enter a number from 1 - 10: " << endl; int small; cin >> small; cout << "\nEnter a number from 10 - 20: " << endl; int big; cin >> big; ``````

So now I have these two numbers, and I'm not sure what the best way to do the rest is.

I tried doing this:
 ``1234`` ``````int sum = 0; for (i = small; i == big; i++) sum = sum + i;``````

but I got an error that said "i is not declared in this scope. If someone could point me in the right direction or get me a beer I would appreciate it.
closed account (LN7oGNh0)
EDIT: Forget what I said, go here: http://www.learncpp.com/cpp-tutorial/57-for-statements/
Last edited on
(insert expletive here) !!!! I should have written:

 ``12345`` ``````int sum = 0; for (int i = small; i <= big; i++) sum += i; ``````