include stdio include stdlib define EPS 1e-5 int main void double prin

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>
#define EPS 1e-5
int main(void)
{
double x,a,n,s,r;
printf("enter x\n");
scanf("%lf",&x);
s=0;
a=-x*x;
n=1;
r=x;
while(r>EPS || r<-EPS)
{
s+=r;
n+=2;
r*=(-1)*a/(n*(n+1));
}
printf("%lf",s);
system("pause");
return 0;
}