so here is what i've come up with...
it seems to me like it should execute correctly, but somewhere something is causing my output to be bogus large numbers; however, it will compile... does anyone see my error, i can't figure it out...
void pi(int n, double *pi_value, int *iterations); //declare function
int main (void)
int n; //number of terms
int iterations = 0; //number of actual loop iterations in pi
double pi_value = 0; //computed value of pi
printf("Please enter an odd integer n; ")'
printf("quit with a non-positive or even integer:\n");
/*-- Read n and display pi. Quit with a non-positive n. --*/
while(n>0 && n%2)
pi(n, &pi_value, &iterations);
printf("%17d: %0.81f with %d iterations\n", n, pi_value, iterations);
void pi(int n, double *pi_value, int *iterations)
int ADD = 1 // 1 = true & 2 = false
for(i=0; i<n; i++)
*pi_value += (4/((n*2)-1));
ADD = 2;
*pi_value -= (4/((n*2)-1));
ADD = 1;