title: How to write a program to estimate the sine function as a Taylor series in C?
body: <p>I'm new to programming and I cannot figure out what is wrong with my code. If there is any way that someone could help me understand what is wrong with my program I would really appreciate it. I have already been working on this problem for two hours and I know I am making it harder than it needs to be. This is my new code. my new output is 0.000000476837158.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  #include&lt;math.h&gt;
  int main() {
           double x, sinx, z, factorial, term;
           int j, n, i;
           x=0.5;
           n=10;
           i=0;
           z=sin(0.5);
           for(int i=0; i&lt;=n; i++){
                        factorial = 1;
                        for(j=2*i +1; j&lt;=i; j++)
                        {
                                 factorial = factorial * j;
                                 }
                        term=(pow(-1,i)*pow(x,2*i+1))/(factorial);
                        sinx=term++;
                        i=i++;
                                     }
                        printf("sin(0.5) is approximately %.15lf\n", sinx);
                        printf("sin(0.5) by default function is %.15lf\n", z);
                        system("pause");
                        return 0;
                        }
  </code></pre>