Code Golf: Leibniz Series
Do everything in one line.
Don't read number of test cases, scanf will return -1 on EOF
Don't include anything, pow(-1,i) can be replaced by 1-i%2*2
Do the sum loop in reverse to save a variable.


Here is my 102 bytes code

main(n){gets(&amp;n);for(double s;s=scanf("%d",&amp;n)&gt;0;printf("%.15f\n",s))while(--n)s+=(1-n%2*2)/(1.+2*n);}