I am trying to figure out how to make a program so that when I enter a starting number and an ending number all numbers between that are added up.
First Number: 1
Second Number: 5
The program will: 1+2+3+4+5 = answer
This is what I have so far
int firstnum, secondnum, x, answer;
answer = 0;
cout<<"Please enter beginning term: ";
cout<<"Please enter ending term: ";
answer = firstnum++;
} return 0;
How would I get it to 1 + 2 + 3 + 4 + 5 using the while loop?
Any help would be appreciated.