Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- long factorial (int n)
- {
- if(n == 0)
- return 1;
- else
- return (n * factorial(n-1));
- }
- int main ()
- {
- int n;
- long f;
- printf("Enter the integer to find Factorial : ");
- scanf("%d", &n);
- f = factorial(n);
- printf("%d! = %ld",n,f);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement