Question: Can somebody help me with this.I need it asap. Write a C program that computes Pi with the approximation algorithm that I introduced in class.

Can somebody help me with this.I need it asap.Can somebody help me with this.I need it asap. Write a C

Write a C program that computes Pi with the approximation algorithm that I introduced in class. I want you to write the program in two different ways The first version will add up the first 28284277 elements of the approximation series in a simple for loop. I ask you to put the code into a function with this signature: float get pi for(void); The second version will break out of a while loop depending on whether a pair of adjacent elements (remember that we always consider a positive element and its adjacent negative right neighbor) is smaller than a certain threshold. I ask you to use the threshold 0.00000000000001. Please put the code of this version into a function with the signature float get pi while(void); . . Put both functions into a file called pi.c. Also write a corresponding header file that has symbolic constants for both the number of LOOPS to be run as well as for the THRESHOLD value. Finally, vrite a file main.c that contains the driver, which will print out pi twice calling the two different functions. I want you to call get pi for0 first, then call get pi while0. Write a C program that computes Pi with the approximation algorithm that I introduced in class. I want you to write the program in two different ways The first version will add up the first 28284277 elements of the approximation series in a simple for loop. I ask you to put the code into a function with this signature: float get pi for(void); The second version will break out of a while loop depending on whether a pair of adjacent elements (remember that we always consider a positive element and its adjacent negative right neighbor) is smaller than a certain threshold. I ask you to use the threshold 0.00000000000001. Please put the code of this version into a function with the signature float get pi while(void); . . Put both functions into a file called pi.c. Also write a corresponding header file that has symbolic constants for both the number of LOOPS to be run as well as for the THRESHOLD value. Finally, vrite a file main.c that contains the driver, which will print out pi twice calling the two different functions. I want you to call get pi for0 first, then call get pi while0

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!