#include<math.h> #include<stdio.h> main() { int a=1,b=1,c=1; float i=0.0,d=0.0001; while(fabs(1./a)>=fabs(d)) { i=i+1/a; if(b%2!=0) c=-1; else c=1; a+=2; a=a*c; b++; } printf("%f\n",i); }