double func(double X, double epsilon)
{
double r = 0, r1=0;
r+=pow(X,1)/fact(1);
r1=r + pow(-1,2.0)*pow(X,3)/fact(3);
for(double n=0;fabs(r-r1)>epsilon;n++)
{
r+=pow(-1,n)*pow(X,2*n+1)/fact(2*n+1);
r1=r + pow(-1,n+1)*pow(X,2*n+1+1)/fact(2*n+1+1);
}
return 1/r;
}
}