Ask Question

Write a C program that asks the user for an angle in degrees and a number of terms, and calculates the Taylor series expansion of the cosine of the angle using the number of terms specified. The program should print the result and it should also print the value of the cosine using the cos function from math. h

+1
Answers (1)
  1. 29 June, 12:28
    0
    int main () {

    double degree;

    printf ("Enter your angle value in degree:");

    scanf ("%If",°ree);

    double radian = degree * (M_PI/180);

    printf ("sin value is %IF/n", sin (radian));

    printf ("cos value is %IF/n", cos (radian));

    printf ("tan value is %IF/n", tan (radian));

    return 0;

    Explanation:

    to solve the problem, first you will need to import the math. h header function.

    All of these methods take one double value as argument and returns the result as double.

    The argument should be in radian, so is the user input is in degree, we need to convert it to radian by multipling the value PI/180. MI_PI is defined in math. h and it holds the value of PI.

    After converting it to radian, we can calculate and print out sin, cos and tan values.

    To make the conversion, just use sin (), cos (), and tan ()
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “Write a C program that asks the user for an angle in degrees and a number of terms, and calculates the Taylor series expansion of the ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers