C Programming Code Examples C > Mathematics Code Examples C Program to Find the Factorial of a Number using Recursion C Program to Find the Factorial of a Number using Recursion This C Program prints the factorial of a given number using recursion. A factorial is product of all the number from 1 to the user specified number. #include <stdio.h> int factorial(int); int main() { int j; int result; printf("Enter a number to find it's Factorial: "); scanf("%d", &j); if (j < 0) { printf("Factorial of negative number not possible\n"); } else { result = factorial(j); printf("The Factorial of %d is %d.\n", j, result); } return 0; } int factorial(int j) { if (j == 0 || j == 1) { return 1; } else { return(j * factorial(j - 1)); } }