0

Hello every one i need to help me in understanding this small program

...you can approximate by using the following series

∏=4(1-1/3+1/5-1/7+1/9-1/11+1/13-.....-1/(2i-1)+1/(2i+1))

write a program that displays the value for i=10000,20000,....,and 100000

I've developed this code to solve the problem

```
public static void main(String[] args) {
int count=1;
double sum=0;
for(int i=1;i<2*i+1;i+=2)
{
if(count % 2==0)
sum-=1.0/i;
else
sum+=1.0/i;
count++;
}
double p=4*sum;
System.out.println("The value of p is "+p);
}
```

my question

is this code I've written solve the problem?

and if yes, what about "compute the value when i is equal to 10000,20000,.....,and 100000"

that is supposed to be implemented in my code