How can I get my while loop to run inclusive? I can run the program to get near results but because I add 1 to the first variable that number gets added to the result. How can I get the output without the added 1 needed to complete the loop? If that makes sense.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#include <iostream>
usingnamespace std;
int main ()
{
int a, b, c = 0 ;
cout << "Enter an integer: ";
cin >> a;
cout << "Enter another integer: ";
cin >> b;
while (a <= b)
{
a = a + 1;
c = c + a;
cout << c << endl;
}
}