Preparing for midterm exam

I am having problem with the setup of the calculation. Please if anyone have
any suggestions for this question then I would appreciate it.

Greetings Neo

Ask value of x and term of n then calculate sine(2x) by sin(2x) =
2x/1! +((( pow(2,3))* pow(x,3))/3!) – ((( pow(2,5))*pow(x,5))/5!) + …. (n term)
and find the different of calculated sin(2x) and sin(2x) by function in C language [use “sin()”]

Example
Enter the value of x = 0.5
Enter the term of n = 4

Calculated sine = …. 1.
sine by C language = ….2.

The different of these two value is = |2.-1.|=….
The same goes here as your other post. You need to be more specific when asking for help. And to try to solve it yourself also
Oh I didn't know that...It is my first time to write a question regarding the c.

here is mine so far....

#include <stdio.h>
#include <math.h>

int main()
{
float x, n, s, s1, i, p=1, sf=0;

printf("Enter the value of x :");
scanf("%f", &x);
printf("Enter the term of n :");
scanf("%f", &n);


for(i=1; i<n; i= i+2)
{
p = p*i;
sf = ((2*x)/p); //not sure about this one
s1 = sf + (pow(2,i))*(pow(x,i))/p; //this one doesn't seem to be complete



}
printf("Calculated sine = %f\n", s1);
s=sin(x);
printf("sine by C language = %f\n", s);

printf("The different of these two value is = %f\n", fabs(s-s1));

return 0;

}
Topic archived. No new replies allowed.