Guest User

Untitled

a guest
May 25th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2. int fact(int n);
  3. int main(void) {
  4. int n;
  5. float result;
  6. printf("Enter Number to find factorial number ");
  7. scanf("%d", &n);
  8. result = fact(n);
  9. printf("Factorial = %f", result);
  10. }
  11.  
  12. int fact(int n){
  13. if(n >= 1){
  14. return n * fact(n - 1);
  15. }
  16. else return 1;
  17. }
Add Comment
Please, Sign In to add comment