i am trying to make a program where a user inputs two numbers. the first number needs to be less then the second. then the program needs to add all the numbers together that fall between those two numbers including the two numbers. for example number1 = 1, number 2= 3.
the program need to output the sum of 1+2+3.
so far all i have is and i dont know what else to do.
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int n1;
int n2;
int total;
cout<<"enter n1: ";cin>>n1;
cout<<"\nenter n2: ";cin>>n2;
while (n1<=n2)
{
n1=n1+(n1+n2);
}
cout<<"\ntotal is: "<<n1;
getch();
}