0

Hi Im writing a beginner program that computes the value of Pi ( pi/4 = 1 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 +... ). I've done this one, but now I want to find out how many terms do i have to use beofre i first get a value that begins with 3.14159

this is the Pi number

```
public class piBegins
{
public static void main(String[]args)
{
double sum = 1.0;
for(double i = 1; i <= 200000; i++)
sum += Math.pow(-1,i)*1.0/(2.0*i + 1.0);
System.out.printf("Pi = %s", sum*4);
}
}
```

first thing i can think of is assigning the value for sum = 3.14159

please help!