Question: Can you please write a C programming Code for this problem? ECE 175: Computer Programming for Engineering Applications Lab Assignment #3 Control Structure User defined

 Can you please write a C programming Code for this problem?

Can you please write a C programming Code for this problem?

ECE 175: Computer Programming for Engineering Applications Lab Assignment #3 Control Structure User defined function File 10 e Problem 1 (total of 20 points): a) ( 10 pts) The value of pi, . can be approximated using the Gauss-Legendre algorithm, which teratively improves a precision of desired accuracy as Initial values: a,-1, bo-to--"Po Repeat the following instructions n times to get desired accuracy anitn+1) tn+1 r is then approximated as Write a Cfunction that calculates the value of pi with a variable level of accuracy. For instance, if the desired accuracy is 10, the absolute difTerence between the true value of pi (see below) and the from your function is less than 10* Function prototype: double Pi valuelint n ASSERT your function by running unit tests (see see 5.7 in your Zybook) for values 3, 4 and 6 Examples of testing your function are const double pi 3.141592653589793238462643383 assertffabs(Pi_value3)-pi)pow(10.0,-3)) assert fabs(Pi valuc 3)- pi)pow(10.0,-4) assert(fabs(Pi value(3)-pi) pow(10.0,-6); [Assertion failed function such that this one will no longer fail change n in Pi value b) (10 pts) You are given the central angle in degrees 0" and radius of the circle r of a circular sector Write a C program that finds the area A of the circular sector. Your Pi value in step a) for the calculation of p. program MUST call the function As * (0/360) See sample code execution on the next page

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!