Suppose you have an array of integers such as 1, 2, 3, 4, 5, 6, 7, 8, 9, 10. Adding up all of its elements is easy. One loop is enough.
int size = 10;
int total = 0;
for (int i = 0; i < size; i += 1) {
total = total + v[i];
}
To add up a different range of elements (positions 5 through 7, for example) you change only a few parts of the loop. In this problem you do that computation many times.