/* Program for sine series
1-x^2/2!+x^4/4!-x^6/6!+..... */
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
double x, sum = 1, m;
int n, i, j, fact, y=2, term=1;
clrscr();
printf("\n Enter x value: ");
scanf("%lf",&x);
printf("\n Enter no.of terms: ");
scanf("%d",&n);
for (i = 1; i < n; i++) {
fact = 1;
for (j = 1; j <= y; j++) {
fact = fact * j;
}
term = term * (-1);
m = term * pow(x, y) / fact;
sum = sum + m;
y += 2;
}
printf("\n Sine series: %.2lf",sum);
getch();
}