include stdio include stdlib include math define EPS 1e-5 run this pro

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define EPS 1e-5
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[])
{
int n=1;
double x,a,s;
printf("VVedite x\n");
scanf("%lf",&x);
s=a=x;
while (a>EPS || a<-EPS)
{
n++;
a*=-x/2*n+1;
s+=a;
}
printf("s=%lf",s);
system ("PAUSE");
return 0;
}