Gnarly in a recursive function!
I can't see where I'm messing things up. Maybe it's time for a coffee break..? Anyhow, I'm trying to calculate the harmonic sum of a series.
Please point out the faulty stuff.Code:
public static double harmonicSum(int n)
double temp = 0;
if( n == 1)
//System.out.println("Test"); Seems to give the right number of out puts.
temp = 1/n;
return temp + harmonicSum(n-1);