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