Write your question here.
Write a C function that approximates sin
function so that you can answer the following question during the lab
a) For a value of x = 0.1, how many terms do you need in the power series so that the result from the
series equals the result from the sin(x) library function up to the 6th decimal place.
Hint: You will need power and factorial functions. For power function, you can use power function that
has a prototype defined as;
double pow(double x, double y)
pow returns the result of x to the power y as a double type. You will need to
include math.h to use this
function (#include <math.h>).
Note that you don’t need put prototype.
Prototype of that power functions is already located in math.h file.
Simply, you need to put include statement math.h in your source code .
The factorial function can be implemented as the following;
double factorial (double n)
{
if(n==0)
return 1;
int factorial = 1;
for (int i = n; i >=1; i--)
factorial *= i;