include stdio include stdlib include math int main void int float sum

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main(void)
{
int n=1;
float sum,x,q,f;
printf("print -1<=x<=1\n\n");
scanf("%f", &x);
if ((x<=1)&&(x>=-1))
{ while(q<(1e-4))
q=1/n;
sum=(pow(-1,n)*pow(x,2n))/(1*(2n-n)*2n);
n++;
printf("\n%f %f\n",q,sum);
}
system("PAUSE");
return 0;
}