Advertisement
eg0rmaffin

fctr_in_ft

Jul 6th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int ff(int a)
  4. {
  5.   int runner = 1;
  6.   int b = a;
  7.   if (a == 0)
  8.     {
  9.       return (1);
  10.     }
  11.   else if ((a > 0) && (a < 13))
  12.     {
  13.       while (runner < b)
  14.     {
  15.       a = a * runner;
  16.       runner = runner + 1;
  17.     }
  18.     }
  19.   else if ((a < 0) || (a > 12))
  20.     {
  21.       return (0);
  22.     }
  23.   return (a);
  24. }
  25.  
  26. main ()
  27. {
  28.   int a = 0;  
  29.   ff(a);
  30.   printf("%d", ff(a));
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement