Calculate sin(x) as the form of series in c++
<p>We know that
   sin(x)=x-x^3/3!+x^5/5!-x^7/7!+x^9/9! and so on. I have written this code:</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;math.h&gt;
using namespace std;

const int m=19;

int factorial(int n) {

    if (n==0){ return 1;}
    return n*factorial(n-1);
}

int main() {
   float x;
   cin &gt;&gt; x;

   float sum=0;
   int k=1;
   for (int i=1;i&lt;=m;i+=2) {
      sum+=(k*(powf(x,i)/factorial(i)));
      k=k*(-1);
   }

   cout&lt;&lt;"series sum is equal :"&lt;&lt;sum&lt;&lt;endl;
   return 0;
}
</code></pre>

<p>One problem is that when I enter x=3 it gives me -10.9136, but I know that values range of sin(x) is [-1, 1] what is problem? Please help me.</p>
