The cosine of an angle can be computed from the following infinite series: Write
ID: 3651545 • Letter: T
Question
The cosine of an angle can be computed from the following infinite series: Write a program that reads an angle x (in radians) from the keyboard and print the cosine of that angle using a function called my_cosine. The my_cosine function computes the cosine of the angle using the first five terms of this series. Note you will need one more function called my_fact to compute factorials, which you also can create. Print the value computed along with the value computed with the cosine function of the C library function cos(x) for comparison.
Explanation / Answer
#include #include void main() { float pow = 2.0, nr, dr = 1.0, x1, sum; int i = 1,n,s = -1,x; clrscr(); printf(“ ENTER THE ANGLE…: “); scanf(“%d”, &x); x1 = 3.142 * (x / 180.0); sum = 1.0; nr = x1*x1; printf(“ ENTER THE NUMBER OF TERMS…: “); scanf(“%d”,&n); while(iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.