Here is the solution you are looking for:
#include<stdio.h>
#include<stdlib.h>
int sum = 0;
int recursive(int x, int MAX)
{
if(x>MAX) //base condition
return 0;
return (x+recursive(x+1,MAX));
}
int main()
{
int start = 4, MAX = 7;
int result = recursive(4,7);
printf("%d ", result);
return 0;
}
Hope this helps, do up vote it if you are satisfied or let me know if there is any confusion.
Thank you