Write a function in C programming language that 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,...


Write a function in
C programming language
that 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.



Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here