An approximate value of pi can be found using this formula: * = 4 [1-3 +...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
An approximate value of pi can be found using this formula: * = 4 [1-3 + - +1 + (Note, n starts as 0 for the first term: (-1)"] 2n+1 =) 2(0)+1 Write a program that approximates pi to a certain number of decimal places. Ask the user to enter n. the number of decimal places of accuracy desired for approximating pi. The tolerance for the while loop should be pow (0.1, n+1). Output: Number of decimal places requested: # Approximation of pi: 3.14... (Output the correct number of decimal places) Number of terms used: # Sample (for 4 decimal places): Number of places requested: 4 Pi 3.1416 Number of terms used: 50000 An approximate value of pi can be found using this formula: * = 4 [1-3 + - +1 + (Note, n starts as 0 for the first term: (-1)"] 2n+1 =) 2(0)+1 Write a program that approximates pi to a certain number of decimal places. Ask the user to enter n. the number of decimal places of accuracy desired for approximating pi. The tolerance for the while loop should be pow (0.1, n+1). Output: Number of decimal places requested: # Approximation of pi: 3.14... (Output the correct number of decimal places) Number of terms used: # Sample (for 4 decimal places): Number of places requested: 4 Pi 3.1416 Number of terms used: 50000
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
2 FERGS Plc has export orders from a company in Singapore for 300,000 widgets and from a company in Indonesia for 150,000 widgets. The unit cost to FERGS of producing widgets is 0.60. The unit sales...
-
During a semester, a class of n=50 students took two exams: a midterm and a final. The mean score for the midterm exam is 80 points with the standard deviation of 6 points. The mean score for the...
-
Imagine that Costco has $500,000 of sales (selling 31,250 units) in August and has a contribution margin ratio of 40% and fixed costs of $20,000. If sales in units increase by 15% in September, what...
-
Write a function my_ieee_2_dec(ieee), where icce is a string contains 64 char- acters of ones and zeros representing a 64-bit IEEE754 number. The output should be d, the equivalent decimal...
-
(a) Write structural formulas or build molecular models for all the noncyclic aldehydes and ketones of molecular formula C4H6O. (b) Are any of these compounds stereoisomeric? (c) Are any of these...
-
An investment project has annual cash inflows of $2,800, $3,700, $5,100, and $4,300, for the next four years, respectively. The discount rate is 14 percent. What is the discounted payback period for...
-
Suppose that country A has 9,000 worker hours available for production and that it initially has the technology given by case 3 of Exercise 1. Derive its PPF and determine its exact dimensions. data...
-
Simmons Corp. can borrow from its bank at 17 percent to take a cash discount. The terms of the cash discount are 1.5/10, net 45. Should the firm borrow the funds?
-
Refer to the Christopher Doner case at: https://www.policefoundation.org/wp-content/uploads/2015/07/Police-Under-Attack.pdf to answer each of the following questions. 1. Discuss at least three things...
-
Hooper Printing Inc. has bonds outstanding with 9 years left to maturity. The bonds have an 8% annual coupon rate and were issued 1 year ago at their par value of $1,000. However, due to changes in...
-
You have been asked to forecast Orwell's additional funds needed (AFN) for next year. Assuming the firm is operating at only 50% of capacity and using the data in the table below, forecast Orwell's...
-
A 0.630-mH inductor and a 128- resistor are placed in series with a 24-V battery. How long will it take for the current to reach 67% of its maximum value? s What is the maximum energy stored in the...
-
SESSION DATE JUNE 21, 2024 15 To: Binh's Bins 672 Alleyway Drive Red Deer, AB T4R 2T4 BINH'S BINS - GENERAL JOURNAL Sylvan Motors 179 Towing Blvd., Red Deer, AB T4P 1S2 Date: June 15, 2024 Truck...
-
Solve the right triangle. 140 75 Find the length of the side adjacent to the given angle. (Round your answer to two decimal places.) 540.92 * Find the length of the hypotenuse. (Round your answer to...
-
NPV= -29,000 + 14,400 /(1+r) + 12,300/(1+r) 2 + 9,200/(1+r) 3 + 5,100/(1+r) 4 . What is the value of r?
-
in a period of 1 5 s , an elevator car which weighs 6 0 0 0 N including its passenger goes from the first floor to the third floor by covering a vertical distance of 3 6 m . what is the average power...
-
Indicate using an 'X' which financial statement would report the following payroll related accounts: El Payable Salaries Expense Payable CPP Employer Benefits Expense Employee Income Tax Payable...
-
A regular deposit of $100 is made at the beginning of each year for 20 years. Simple interest is calculated at i% per year for the 20 years. At the end of the 20-year period, the total interest in...
-
Karim Depak received a Form 1099-B showing the following stock transactions and basis during 2012: None of the stock is qualified small business stock. Calculate Karim's net capital gain or loss...
-
Laura is a single taxpayer living in New Jersey with adjusted gross income for the 2012 tax year of $35,550. Laura's employer withheld $3,300 in state income tax from her salary. In April of 2012,...
-
Bill and Guilda each own 50 percent of the stock of Radiata Corporation, an S corporation. Guilda's basis in her stock is $25,000. On July 31, 2012, Bill sells his stock, with a basis of $40,000, to...
-
What are the four subfields of anthropology?
-
To what extent do you think there is a link between the product cycle theory as developed by Vernon and the Linder theory? Explain.
-
The UK government has recognized the importance of information and behavioural economics to decision-making. The government partly funds the Behavioural Insights Team (BIT) in conjunction with an...
Study smarter with the SolutionInn App