title: Factorial program c using recursive function in C with while loop
body: <p>Factorial program using recursion in c with while loop.In this program once the execution reaches the function return statement it will not go back to the function call. Instead,it executes the function repeatedly. can anybody please tell me what's wrong in this program.</p>
  
  <pre><code>#include&lt;stdio.h&gt;    
  int fact(int n)
  {    
      int x=1;    
  
      while(n&gt;1)    
      {    
          x=n*fact(n-1);    
      }    
  
      return(x);    
  }    
  
  void main()    
  {    
      int n,fact1;    
      scanf("%d",&amp;n);    
      fact1=fact(n);    
      printf("%d",fact1);    
  }
  </code></pre>