Write a function inC programming languagethat gets two ints x and y, and returns the sum of all ints between x and y, including them.
int sum_interval(int x, int y);
For example:
- sum_interval(1, 4)returns 1+2+3+4=10.
- sum_interval(10, 3)returns 3+4+5+6+7+8+9+10=52.
- sum_interval(2, -1)returns (-1)+0+1+2=2.
- sum_interval(-1, -1)returns -1.
Note that we may have x>=y or x<>
You may assume that the sum will be within the range of int.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here