int i=1;
double x=
-5, eps=
Math.
pow(0.1,
5), sum=
0.0, elem=
1.0;
do
{
sum+=elem;
elem*=x/i;
i++;
}while( Math.
abs(elem
)>=eps
);
sum = 0.0; i=1; x=-5; elem=1.0;
do
{
sum+=elem;
i++;
}while( Math.
abs(elem
)>=eps
);
sum = 0.0; i=1; x=-5; elem=1.0;
double n = 1000.0, s = x/n;
do
{
sum+=elem;
elem*=s/i;
i++;
}while( Math.
abs(elem
)>=eps
);