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