//AN IMPLEMENTATION TO FIND SUM OF SIN SERIES....x-3x/3!+5x/5!-7x/7!+9x/9!_ _ _ _ _ _ _ _ nx/n!//
#include<stdio.h>
int main()
{
float sum=0;
int x,i,j=1,fect=1;
printf("ENTER THE VALUE OF X\n:");
scanf("%d",&x);
for(i=1;i<=x;i++)//i=1..2.3..4.5.6.7..8..9
{
fect=fect*(j-1)*j;//bcz value for fectorial i.e. 1 ...3...5...7...9 is incrementing by 2..then instead of fect=fect*j....fect=fect*j*(j-1)...is done so that previous term could be multiply also to find fectorial of next term.../
//suppose i have to find fectorial of 5!...there is fect=3! already ...so i have to multiply fect with 4 & 5 now
//so fect =3! *4 *5=3! *(j-1)*j/////
if(j==1)
fect=1;//in 1st time fect is not 0...its 1 for j==1..//
if(i%2 != 0)//everytime once + operation is performed
{
sum=sum+(x*((float)j/(float)fect));//in + operation..sum+(x*j/fect)/...as in above terms in series is done
//j is number...fect is fectorial of j number...x is multiplyed by dividing both (num/fect of num)..//
if(i!=x)
printf("%d*(%d/%d) -",x,j,fect);
}
else if(i%2 == 0)//for even value of i...once '-' operation is performed//
{
//printf("\nfect=%d\n",j/fect);
sum=sum-(x*((float)j/(float)fect));//in - operation ... - is done in sum of series..//
//j is number...fect is fectorial of j number...x is multiplyed by dividing both (num/fect of num)..//
// printf("sum=%d\n",sum);
if(i!=x)
printf(" %d*(%d/%d)+ ",x,j,fect);//for printf statement used...execept last time ..//
}
j=j+2;//j=j+2 ...means j has odd value everytime ..//
}
printf("%d*(%d/%d)=%f",x,j-2,fect,sum);//at last time sum is performed...//