Question: 25 points] You've been hired by PI Throwers to write a C++console application that approximates PI. Use a validation loop to prompt and get from

 25 points] You've been hired by PI Throwers to write a

25 points] You've been hired by PI Throwers to write a C++console application that approximates PI. Use a validation loop to prompt and get from the user the number of terms to approximate PI to that is at least 1. Use the following Leibniz PI approximation = 4 * (1/1-1/3 + 1/5-1/7 + 1/9-1/11+ ) The terms appear within the parentheses in the formula. A PI approximation to. One term is 4(1/1) 4 Four terms 4(1/1 1/31/5 1/7)-2.8952380952 Seven terms 4(1/1-1/3 1/5 1/7+1/9-1/111/13) 3.2837384837 Use a for statement to calculate the number that will be multiplied by four. The loop will add and subtract terms to get the number. If i is the indexing variable, use condition i % 2-0 to determine whether each loop iteration is even or odd and whether an add or subtract is done. In each term, the dividend is always 1, and the divisor is an odd number starting with 1 that goes up two at a time. Format the approximation to ten decimal places. Use number of terms 1,000 for your last run

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!