Question: Create program using C. Lab3 Loops PROGRAM SPECIFICATIONS Pi can be approximated by the following series 4 - 4/3 + 4/5 - 4/1 + 4/9

Create program using C.Create program using C. Lab3 Loops PROGRAM SPECIFICATIONS Pi can be approximatedby the following series 4 - 4/3 + 4/5 - 4/1 +

Lab3 Loops PROGRAM SPECIFICATIONS Pi can be approximated by the following series 4 - 4/3 + 4/5 - 4/1 + 4/9 - 4/11 As you add more terms of the series together, you get the value of Pi with more precision. The drawback to this series is that it very slowly approximates Pi. However since we have a computer, we can overcome this to some degree because of the speed at which computers perform arithmetic. Your task Get an integer greater than 9 from the user that represents to which term to approximate Di You must ensure the integer they enter is greater than 9 As long as the user enters an invalid umber, re-prompt for input Once a valid integer is obtained calculate the approximate value of Pi to that term As you to that print the values of the 10 terms leading up to and including the last term specified formatted to 15 digits to the right of the decimal point, preceded by the term number (see example run below). Note that this means you need to do double arithmetic to avoid the significant figure limitations of float. . After the results have been displayed the meer should be asked if she wants to perform another approximation of Pi - If the answer is yet another term and perform the calculation as specified above. . The user should be asked if she wants to go again until the answer is n. . You must handle all cases of y' and 'n Make sure that when you print the terms they are in nice columnar form. Make sure that the table has its terms right-justified so that the value of 5 prints as " while 10 prints as "10". EXAMPLE RUN: Welcome se she Pi approximation program. This program will approximate based on the following series: 4 - 4/3 + 4/5 - 4/7 + 4/9 -... Enter the term bez to which you would like to approximate Pi (note that is team 2, 4/2 is ter 2): 9 Invalid input! Please enter a ter greater than 9: -999 Invalid input! Please enter a ter greater than 9: 0 Invalid input! Please enter a ter greater than 9: 20 The values of 2: Eres tem 11 totes 20 are Term 11: 3.232315809405599 Term 12: 3.058402765 Term 13: 3.21940276 Term 14: 3.0702546 Term 15: 3.208185 Term 16: 3.079153894 Term 17: 3.2003655 Term 18: 3.09607980 Term 19: 3. 194187909231942 Term 20: 3.091622206667840 Would you like to try again (ya)? 3 Invalid input, please enter y On: Y Enter the term race to reach you would like to approximate Pi (note that is een 1, 4/3 - 2): 10 The values of 2: Ezen tem 1 to be 10 aze Term 1: 4.0000000000 Term 2: 2.6666666668 Term 3: 3.4666666 Term 4: 2.895239 Term 5: 3.335 69253 Term 6: 2.9760461 Team 7: 3.283739483 Term 8: 3.017071817071819 Temm 9: 3.252365934718877 Term 10: 3.041839619929403 Would you like to try again (ya)

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!