/* Calculate sin value using Taylor series expansion Emad Arasteh October 10, 2019 */ #include int main() { /* variable declaration */ double x, y, x_2, x_3; /* input section */ printf("Please enter the input value (in radians): "); scanf("%lf", &x); /* computation */ x_2 = x * x; x_3 = x * x * x; /* y = x - x*x*x/6 + x*x*x*x*x/120 + x*x*x*x*x*x*x/5040 */ y = x - x_3/6 + x_3*x_2/120 - x*x_3*x_3*x/5040 - x_3*x_3*x_3/362880; /* output section */ printf("The value of sin(%f) is %f \n", x, y); return 0; }