Showing posts with label EVALUATION OF SINE SERIES. Show all posts
Showing posts with label EVALUATION OF SINE SERIES. Show all posts

Friday, January 16, 2015

EVALUATION OF SINE SERIES

PROGRAM:

#include<stdio.h>

#include<math.h> int factorial(int n)

{

int i,sum=1; for(i=1;i<=n;i++)

sum=sum*i; return sum;

} main()

{ int i,n,j,dr;

float res=0.0,x,nr;

printf("\nEnter the Value of x\n"); scanf("%f",&x);

printf("\nEnter the total no of terms\n"); scanf("%d",&n);

j=1;
for(i=1;i<n*2;i+=2)

{

nr=pow(x,i)*j;
dr=factorial(i);

res+=(nr/dr); j=-j;

}

printf("The Result of sine series is : %f\n",res);

}


 OUTPUT:

Enter the Value of x 0.21

Enter the total no of terms 5

The Result of sine series is : 0.208460