Question: PROGRAMMING LANGUAGE C You are now allowed to use the following in additional to the techniques of the previous chapters: for loops math.h and pow()

PROGRAMMING LANGUAGE C

You are now allowed to use the following in additional to the techniques of the previous chapters:

for loops

math.h and pow() function

formatting float and double numbers

switch statements

getchar() function

ASCII chart

dowhile loops

break and continue statements

Logical AND (&&), logical OR (||), logical NOT (!) operators

PROGRAMMING LANGUAGE C You are now allowed to use the following in

6-uCF Federe \"Signintoy x-D 01 3406632 x Grades for e chegg Stu/X \ e PROGRAM e PROGRAM x e replit-Ho x / D Homework x d file://C:/Users/Valeria%20Moctezuma/Downloads/Homework-04-Spring-2018.pdf Homework-04-Spring-2018.pdf 212 Q4: (Approximating as follows ) (25 points) The value of can be approximated with the infinite series 1 3 5 7 9 11' Write a program that determines how many terms in takes using the above infinite series to approximate to 3.14159. You can state the answer to this question in the word document you submit, if you obtain the answer through trial and error Bonus (5 points): Your program should stop itself when the precision is met and output the following It took n terms to approximate pi to 3.14159 Hint: Think about a numerator and a denominator. You learned in a previous homework how to generate odd number sequences. Pay close attention to the sign of each term. Casting: You can eliminate all numbers beyond the 5th decimal position using casting, such as int a = (int)(314159265 * 100000). Here a float is being multiplied by an integer, with the result being a float. The decimal point has been moved 5 places to the right. Use (int) to "cast" that into an integer, truncating all the decimals of the new number, resulting in the new number 314159 O Type here to search 7:16 PM 2/18/2018

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!