#include<iostream.h>
#include<math.h>
double SUMFUN(double,int);
void main()
{double y;
int m;
cout << "Enter the value of X: ";
cin >> y;
cout << "\nEnter the value of n: ";
cin >> m;
SUMFUN(y,m);
cout << "\nThe sum of the series X + X^2/3! + X^3/5! + X^4/7!.... upto " << m << " terms is: " << SUMFUN(y,m);
}
double SUMFUN(double X, int n)
{ double res,temp,div;
int fact=1;
{ for(int i=1;i<=n;i++)
fact=1;
if(i!=1)
{ fact=1;
for(int k=1;k<=2*i-1;k++)
fact=fact*k;
}
temp=pow(X,i);
div=temp/fact;
res+=div;
}
return(res);
}