So given an array like this if we want to calculatesum(3, 7) the first thing may come to your mind is using a loop over this range and we are done. and that's totally fine and the simplest solution the better intresult=0;for(inti=2;i<=6;i++){result+=arr[i];} Butwhat if ...