#include <conio.h>
int main()
{
double x;
double fac=1;
double scale=1;
double ans=1;
double sum=0;
double sign = 1;
printf("x = ");
scanf("%lf",&x);
for(int i=0; ans>=1e-06; i+=2)
{
for(int j=1; j<=i; j++)
{
fac*=x;
scale*=j;
}
ans = fac/scale;
sum += sign*ans;
sign *= -1;
fac = 1;
scale = 1;
}
printf("%lf",sum);
getch();
return 0;
}
沒有留言:
張貼留言