I need help on this question :(. I cant seem to get the right output for this question.

5.25

(Compute pi) You can approximate pi by using the following series: p=4(1- 1/3 + 1/5 - 1/7 + 1/9 - 1/11..... +((-1)^i+1/2i-1)

Write a program that displays the p value for i = 10000, 20000, ..., and

100000.

```
{
public static void main(String[] args)
{
for (int i = 10000; i <= 100000; i += 10000)
{
//Declare Values
double equation = 1.0;
{
//Equation
equation = (Math.pow(-1.0, i + 1)/(2 * i - 1));
}
// Formula
double pi = 4.0 * equation;
// Output Pi
System.out.println("i = " + i + ". The PI is " + pi);
}
}
}
```