Sunday, August 2, 2009

Write a program in C using functions to implement Sine Series?

Plz, Give me the code of this program.


Plz.

Write a program in C using functions to implement Sine Series?
double sin(double x)


{


double numerator = x;


double denominator = 1.0;


double sign = 1.0;


double sin = 0;





// terms below define the number of terms you want


int terms = 10;


for ( int i = 1 ; i %26lt;= 10 ; i++ )


{


sin += numerator / denominator * sign;


numerator *= x * x;


denominator *= i*2 * (i*2+1);


sign *= -1;


}


return sin;


}


No comments:

Post a Comment