title: Segmentation fault in C recursive Combination (nCr)
body: <p>PLease help me out here. The program is supposed to recursively find out the combination of two numbers. nCr = n!/ (r!(n-r)! ). I'm getting this error message when i compile it on GCC. </p>
  
  <h2> Here's what the terminal shows:</h2>
  
  <p>Enter two numbers:
  8
  4
  Segmentation fault</p>
  
  <hr>
  
  <p>(Program exited with code:139)</p>
  
  <p>The code is given here:</p>
  
  <pre><code>    #include&lt;stdio.h&gt;
  
  float nCr(float, float, float);
  
  int main()
  {
  
   float a, b, c;
   printf("Enter two numbers: \n");
   scanf("%f%f", &amp;a, &amp;b);
   c = nCr(a, b, a-b);
   printf("\n%.3f", c);
   return 0;
  }
  
  float nCr(float n, float r, float p)
  {
  
          if(n&lt;1)
   return (1/(p*r))*(nCr(1, r-1, p-1));
  
   if(r&lt;1)
   return (n/(p*1))*(nCr(n-1, 1, p-1));
  
   if(p&lt;1)
   return (n/r)*(nCr(n-1, r-1, 1));
  
   return ( n/(p*r) )*nCr(n-1, r-1, p-1);
  }
  </code></pre>