have to compute a function that calculates a sum in between a range let say user enters value of 10 and end value of 15 and then it is divided by a a divisor entered by the user say 2
I have the following code but its not working quite right
its a user defined function fyi
int Range (int start, int end, int divisor)
{
int range, counter, sum;
sum=0;
for (counter=start; counter<end; counter++)
{
sum= start + counter;
}
range = sum / divisor;
return range;
}
the answer should equal 36
g. sum integers in a range that are evenly divisible by a specific integer
hmm edit ill work on this my code is wrong