Why does my sin calculating code in C return the wrong value?
问题 I want to calculate the sinus of user inputs using my own functions based on this equation: sin(x) = sum_(i=0)^n (-1)^i * (x^(2 i + 1)/((2 i + 1)!)) I have this code and to my understandings I do exactly the same as what's written in the equation: #include <stdio.h> #include <math.h> int faculty(int factor) { int result = 1; if (factor > 0) { for (int i = 1; i <= factor; i++) { result = result * i; } } else { result = 1; } return result; } double my_sin(double x, int n) { double my_sin = 0;