I am trying to create a method that is tail recursive and finds the sum
of an equation (i / 2i + 1
) where i
needs to increment 1-10
. I'm having trouble with how to reach the base case and make the recursion cease.
This is what I have so far:
public class SumSeries {
public static void main(String[] args) {
System.out.println(sumSeries());
}
public static double sumSeries(){
int i = 10;
if (i == 0)
return 0;
else
return (i / (2 * i + 1));
}
}