This program runs very smoothly, except that it doesn't print the value of i and is obviously not running the second loop to calculate the margin of error but I don't understand why. Any help?

```
// This program was designed to calculate the value of pi
import java.util.Scanner;
public class Leibniz {
public static void main(String[] args)
{
Scanner input= new Scanner(System.in);
System.out.println("Please enter the number of terms to sum");
//Asks user to input range of numbers
int terms= input.nextInt();
int nextValue = 1;
int Counter = 0;
double pi1 = 0.0;
int operation= 1;
// The loop to sum and calculate pi
while(Counter < terms)
{
pi1 += operation* 4.0/ nextValue;
operation*= -1; //to contrast the minus and plus in the method
nextValue += 2; // to keep the denominator an odd number
Counter++;
}
System.out.println(pi1);
double pi= 3.141592653589793;
System.out.println(pi);
System.out.println("Please enter the value of error");
//Asks user to input the error value
double error= input.nextDouble();
int i=0;
while (pi1!=pi){
if (pi1>pi){
pi1-=error;
}else if (pi1<pi){
pi1+=error;
}i++;
}
System.out.println(i);
}
}
```

Thank you!