Answer:
public static int summation(int low, int high) {
int sum = 0;
for(int i=low; i<=high; i++) {
sum += i;
}
return sum;
}
Explanation:
- Initialize sum variable to hold the sum
- Inside the for loop which iterates from low to high, calculate the sum of the numbers between low and high
Then:
- Return the sum