#include<stdio.h>
#include<conio.h>
long int fact1(int n);
int main() {
int n;
printf("Enter a positive integer: ");
scanf("%d",&n);
printf("Factorial of %d = %ld", n, fact1(n));
getch();
return 0;
}
long int fact1(int n) {
if (n>=1)
return n*fact1(n-1);
else
return 1;
}
Enter a positive integer: 8
Factorial of 8 = 40320
--------------------------------
Process exited after 7.488 seconds with return value 0
Press any key to continue . . .