- #1

- 27

- 0

**urgent help with c++ program for series**

i wanna form program 2 sum this

pie=4[1-1/3 +1/5 -1/7+..... 1/n]

{

int n,z,i;

float x,y,pie;

cin>>n;

i=0;

while (i<=n)

{

y=1/((2*i)+1);

i=i+2;

}

for(z=1;z<=n;z=z+2)

{

x=1/((2*z)+1);

}

pie=4*(y-x);

cout<<pie;

}

cant understand wat to do...this is wat i did but its giving 0