I'm trying to write code to basically mimic the sum to infinity expression, Sine - Wikipedia, the free encyclopedia, but with a finite number of terms, and have the user input the number of which the sine is to be calculated.
This is what I've done so far and I'm stuck now, I dont know where to go and it's not working for me... Any help is appreciated.Code:#include <stdio.h>#include <stdlib.h> #include <math.h> int main() { double i,n,x, factorial, sinx; printf("Enter angle x \n"); scanf("%lf", &x); factorial = 1; for(i=0; i<((2*n)+1); i++) { factorial=(factorial)*(i+1); } for (n=0; n<100; n++) { sinx = (pow(-1,n)*pow(x,(2*n)+1))/((2*n+1)*factorial); } printf("sinx = %f\n", sinx); return 0; }