X323: sumRange

Given two integers low and high representing a range, return the sum of the integers in that range. For example, if low is 12 and high is 18, the returned values should be the sum of 12, 13, 14, 15, 16, 17, and 18, which is 105. If low is greater than high, return 0.

Examples:

sumRange(12, 18) -> 105
sumRange(1, 5) -> 15
sumRange(1, 100) -> 5050

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.