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> int main(void) { int n=1; float eps=1e-5,x,c=x-1,z=n*x,a=c/z,sum=0; scanf("%f", &x); while(fabsf(a) > eps) { c*=c; x*=x; sum+=a; n++; } printf("%f\n", sum); system("PAUSE"); return 0; }