Skip to content
Home » Blog » C Program to find factorial

C Program to find factorial

Find factorial

Here in this Tutorial, you’ll learn How to find Factorial in C Programming.

What is the factorial of a number and how to find factorial?

  • Factorial is denoted by the symbol ‘!’. For example, the factorial of a number 4 is denoted as 4!. Factorial of a number is defined as the product of “the number and all integers less than that number except zero and negative integers”.
  • Natural numbers ( non-negative integers ) which are greater than zero are used for the factorial concept.

Factorial Example:

Zero factorial (0!) = 1
one factorial (1!) = 1
Two factorial (2!) = 2*1 = 2
Three factorial (3!) = 3*2*1 = 6
Four factorial (4!) = 4*3*2*1 = 24
Five factorial (5!) = 5*4*3*2*1 = 120

The common mathematical formula for finding the factorial of the number ‘n’ is given below.

n! = n ( n – 1)( n – 2)( n – 3) …… (1)

Program to find Factorial

#include <stdio.h>
int main()
int i,fact=1,num;

printf("\nPlease enter a number to find factorial : ");

if (num<0)
printf("\nPlease enter a positive number to");
printf(" find factorial and try again. \n");
printf("\nFactorial can't be found for negative");
printf(" values. It can be only positive or 0 \n");
return 1;

printf("Entered number is %d and it's factorial (%d!) is %d\n",num,num,fact);
return 0;


Please enter a number to find factorial : 7
Entered number is 7 and it’s factorial (7!) is 5040

C Program To Find Factorial

Related C Programs

  1. C Program to Add Two Integers
  2. C program for prime number
  3. C program for Fibonacci series
  4. C Program to Compute Quotient and Remainder

Ask your questions and clarify your/others doubts on C Program to Find Factorials by commenting. Documentation