Question: Could you please write it as a program in C (visual Studio) The value of pi (t) can be estimated by the following formula: 12

Could you please write it as a program in C (visual Studio)  Could you please write it as a program in C (visual

The value of pi (t) can be estimated by the following formula: 12 22 3 limit' ) Write a program that uses this formula to calculate pi. a. In function main prompt the user for the number of terms (limit) to be used in the approximation for pi. Restrict the number of terms to an integer between 25 and 75 (including 25 and75) terms by using a while or do... while data validation loop. b. Call a function to calculate the approximation value for pi, using the formula above. The function receives the number of terms in the approximation sum and returns the approximation. Calculate the approximation value using a for loop for the sum. Print the approximation in function main with 6 decimal digits. (Part b may be written entirely in function main with a deduction of 5 points.) c. Back in fiunction main print a table of radius values from 2 to 20 at intervals of 2 and corresponding sphere volumes(V-4/3r), using the value of pi from the approximation formula found in part b. (lf you could not get part b to work, you may use 3.14159 as the value of pi for this part.) Use integers for radius and doubles for volume. Place column headings above the table and print radius values in the column on the left with 0 decimal digits and volumes in the column on the right with 2 decimal digits. For 3 bonus points, use a function for this table instead of writing the commands in function main

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!