#include <stdio.h>
#include <math.h>
int fact(int a)
{ int f,mul=1;
for (f=a;f>0;f--)
{
mul=mul*f;
}
return mul;
}
int main()
{
int x,n,i,j;
float sum=1.0;
printf("Enter the x value:\n");
scanf("%d",&x);
printf("Enter the n value:\n");
scanf("%d",&n);
for(i=0;i<=n;i++)
{
sum=sum+((pow(-1,n)*pow(x,(2*i)))/fact((2*i)+1));;
}
printf("Taylor series of sin(x)= %f ",sum);
}
To embed this project on your website, copy the following code and paste it into your website's HTML: