The code given looks OK, but if you want the sum without including the last number, as is generally the case you should change the for loop like this
for(; index < endno; index ++)
solved Sum of the all the numbers between a and b [closed]
The code given looks OK, but if you want the sum without including the last number, as is generally the case you should change the for loop like this
for(; index < endno; index ++)
solved Sum of the all the numbers between a and b [closed]