do positive integers include 0 code example
Example 1: Given two integers a and b, which can be positive or negative, find the sum of all the integers between including them too and return it. If the two numbers are equal return a or b.
getSum(1,3)
1 + getSum(2,3)
1 + ( 2 + getSum(3,3))
1 + ( 2 + (3))
Example 2: Given two integers a and b, which can be positive or negative, find the sum of all the integers between including them too and return it. If the two numbers are equal return a or b.
const getSum = (a, b) => 1/2 * Math.abs((a ** 2 + a - b ** 2 - b));