#include<iostream.h>
#include<conio.h>
class harmonic
{
public:
float ans;
harmonic()
{
ans=0;
}
float process(float i)
{
if(i==0)
return 0;
ans+=process(i-1);
return 1/i;
}
};
int main()
{
clrscr();
float n;
cout<<"Enter the Value of n:";
cin>>n;
harmonic ob;
ob.process(n+1);
cout<<"The Answer : "<<ob.ans;
getch();
return 0;
}
// Special Thanks to Gostkiller ( Midhul )...
thanks 4ur mention bro
ReplyDelete