title: Floating Point Exception of my Excercise (C language)
body: <p>I've just made a program that implements a binomial function <code>(n!/k!*(n-k)!)</code>.</p>
  
  <p>I can compile my program without any problems but when i scanf the 2 int (n and k), it says "Floating Point Exception". </p>
  
  <p>I've tried many ways to fix it but i can't find the problem because i'm not good with c programming :( I'm learning.
  Someone can help me please?
  Thank you very much.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int factorial( int n ){
      int result;
      if( n == 0 ){
          result = 0;
      } else {
          result = n * factorial((n - 1));
      }
      return result;
  }
  
  char *stringa_binomiale(int n, int k){
  
      char *s;
      s=malloc(sizeof(char)*20);
  
      int b;
  
      b = factorial(n)/(factorial(k)*factorial(n-k));
  
      sprintf(s,"%i su %i fa %i",n ,k ,b);
  
      return s;
  }
  
  int main (void){
  
      int n;
      int k;
      char *s;
      s=malloc(sizeof(char)*20);
  
      printf("n:");
      scanf("%i",&amp;n);
      printf("k:");
      scanf("%i",&amp;k);
  
      s= stringa_binomiale(n,k);
      printf("%s \n", stringa_binomiale(n, k));
  
      free(s);
      return 0;
  }
  </code></pre>