0

I have been working on this assignment for a while and cant get the end result to work. Can anyone help?

Assignment

Write a function called sumTo that takes as arguments two integers. Your function should use a loop to sum all of the numbers between the two (This includes the starting and ending numbers) and return the sum.

Your function should allow for either argument to be the larger. for instance, passing the numbers 1, 5 or 5, 1 should return the same sum

From main ask the user for two numbers, call the function, and print the sum when the function returns.

Here is an example:Enter two number

1 5The sum of all the numbers is 15

What I have so far.

```
#include <iostream>
using namespace std;
int sumTo(int, int);
int main() {
int numb1,numb2;
cout<<"Please enter a number: ";
cin>>numb1;
cout<<"Please enter another number: ";
cin>>numb2;
sumTo(numb1,numb2);
return 0;
}
int sumTo(int num1, int num2) {
int counter = 0;
int result = 0;
if(num1 < num2) {
while(counter < num2) {
result += num1;
cout<<result<<endl;
counter++;
}
}
return result;
}
```

I don't know how I can get the end result please help.

Thanks :)