double denom = 3;
double pi;
double x = -1;
int i;
pi = 4*(1-((double)1/denom));
for (i=1 ; i<=30000 ; i++){
x = x*-1;
denom = (double)x*(denom+2);
pi = pi + denom;
System.out.println(i + " " + denom);
this code supposed to print denom at an alternating operation sequence in increasing value by 2.. but it only prints
5, -7 ,5 ,-3 , 5, -7 , 5,-3 over and over. helP!