[funtion](https://i.stack.imgur.com/6Su96.png)

I have been trying too loop the "1 + 1/3 + 1/5 + ... + 1/n" part in the screenshot inside my code but could not do it all.

The compiler calculates 'x' which is the factorial correctly the only problem for me now is looping the fractions in the function.

```
int main()
{
int i=1,n,x=1;  //x : factorial
double f;

cout<<"Enter an odd number : "<<endl;
cin>>n;

if (n%2==0)
{
    cout<<"You have to enter an odd number."<<endl;
}
else
{
    while(i<=n)
    {
        x = x * i;
        f = x*(1+(1.0/n)) ;
        i+=1;
    }
}
cout<<"f = "<<f<<endl;}

```