Describe a recursive algorithm for computing the nth Harmmon
Describe a recursive algorithm for computing the nth Harmmonic number, defined as
Describe a recursive algorithm for computing the nth Harmonic number defined as H_n = sigma^n_k = 1 1/k.Solution
In this algorithm, we have to add all the inverse numbers till n numbers.
For this we can make a simple function of recursion that we automatically called till condition not got true.
int harmonic(int n)
{
if(n==1)
return 1;
else
return 1/n + harmonic(n-1);
}
So i have created a small code for this harmonic value. You can directly use it and put the value of n in the argument of harmonic function call.

