title: How to input a mathematical expression from keyboard?
body: <p>I have a simple C program </p>
  
  <pre><code>int main()
  {
  
      int n, maxn = 21;
      float SN, x;
  
      printf("input x:");
      scanf("%f", &amp;x);
  
      printf("input maxn:");
      scanf("%d", &amp;maxn);
  
      for(n=0;n&lt;=maxn;n++){
          SN = SN + pow(x,n);
          n = n + 1;
      }
  
      printf("%f", SN);
      getch();
      return 0;
  }
  </code></pre>
  
  <p>I need to make it versatile so the user can enter any expression to replace pow(x, n) with whatever  the user inputs from keyboard. How do I put an expression into the program?</p>