Question: Programming in c, I've written a program to compute the digits of pi. I can't figure out how to print the result every 10,000 iterations.

Programming in c, I've written a program to compute the digits ofProgramming in c, I've written a program to compute the digits of pi. I can't figure out how to print the result every 10,000 iterations. At the moment it prints every single iteration. Any help is appreciated!

#include #include #define EPOCH 10000 //EPOCH defined as a macro int main() int iteration; //int declaration of user input printf("How many iterations of 10,000 would you like: "); //prompt scanf("d", Siteration); //store user input in variable to be used in Loop int total = iteration - EPOCH; //converts the iterations into EPOCH double pi = 0.; //pi set to for alternating signs for(int i=1;ic total;i++) { //for loop to execute for a given number of EPOCHS if (i42 = ) { //if statement to mimick the alternating signs of the taylor series pi = pi - double) (4.0 / (2* i - 1)); // executed second and alternates from there on else { //executed for the positive elements pi = pi + (double) (4.0 / (2* i. 1)); //executed first then alternates printf(" ed: The value of pi is: 9.101f", i, pi);// prints value of pi and number of iterations return 0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!