Question: D Laboratory Programming x CSecure https:/blackboard.sdsu.edu/bbcswebdav pid-4363357-dt content-rid-83712425 1/courses/COMPE160-01-03-CX-Fall2015 Labora 4.pdf Laboratory Programming Exercise 04.pdf 1 2 Write a program using one or more iteration

D Laboratory Programming x CSecure https:/blackboard.sdsu.edu/bbcswebdav pid-4363357-dt content-rid-83712425 1/courses/COMPE160-01-03-CX-Fall2015 Labora 4.pdf Laboratory Programming Exercise 04.pdf 1 2 Write a program using one or more iteration structures to approximate the cosine function, given a radian value x, input using scanf . During each iteration of the summation, output the value of the iteration index k. the kh approximation of cosfx), and he kh approximation error error,-cos, (x)-cos-(x) where cosfx) refers to the klh iteration approximation and coSx)is the value returned by the C standard library cosine function. Example output: S Lab04.exe 2 3.14 x: , cos (x): 1.000000, err : 1.999999e+00 : , cos (x:-3.929300, orr: 2.929302o+00 k: 3, {x): -1.210518, err: 2.105196e-01 x: 4, {x): -0.976140, err: 2.385835e-02 k: 5, cos (x:-1.001817, err: 1.818018e-03 k: 6, cos(x): -0.999899, er: 9.9880ae-05 : , cosx-1.000003, er: 4.009919e-06 : ,cos (x:-0.999998, err: 2.8161546-0 k: 9, cox: -0.999999, err: 1.624061C-0 : lo, cos {x): -0.999999, r: 1.6240 61e-07 Sab04.exe 3.14159265359 : ,cos(x: 1.D00o000, e 2.0000e+DO : cos(x-3.934803, er: 2.934803e+00 : 2, cos (x: 0123910, orr: 1.123910c+00 k: 3, cos {x): -1 .211.353, rr: 2.11352 9e-01 : , cos(x0.976022, e: 2.397776e-02 k: 5, CO 8 {x): -1.001829, err : .829147e-03 : 6. cos x-0.999900, err 1.004338e-04 : 7, cos (x:-1.00000, e: 4.172325e-06 O 4:21 PM Type here to search 91121
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
