# Find Factorial of Number C Program

By | September 17, 2015

## C Program To Find Factorial of Number

Learn How To Find Factorial of Number in C Programming Language. It is important that we should know about How A For Loop Works before getting further with the C Program Code. This Code is described with an Explanation of Factorial Program in C Language. We have used Recursion method as well as the While and For Loops in the following Factorial Programs.

#### What is a Factorial of a Number?

A Factorial for a Non-Negative Integer is the Product of all the Positive Integers Less than or Equal to that Number. The Factorial Notation is used in Combinatorics, Permutations, Algebra and other Mathematical Analysis.

#### Example

5! = 5 * 4 * 3 * 2 * 1 = 120

One interesting thing to note here is that the value of 0! = 1.

Must Read: C Program To Find Factorial of Large Numbers

#### Method 1: Calculate Factorial of Number in C with While Loop

Must Read: C Program To Display Fibonacci Series

#### Method 2: C Program To Find Factorial of a Number using For Loop

Must Read: C Program To Find Greatest Common Divisor of Two Numbers

#### Method 3: C Program To Calculate Factorial using Recursion Method

Must Read:  C Program To Calculate Value of nPr in Probability

#### Output

If you have any compilation errors or doubts in this C Program To Find Factorial of Number , let us know about in the Comment Section below. Find more information about the Factorial of a Number in this Wikipedia article.

## 10 thoughts on “Find Factorial of Number C Program”

1. Dipak Kale

Thanks for so many ways to solve factorial program in c programming. Helped to match differences between for and while loops.

1. Tushar Soni Post author

You’re welcome Dipak! Our main aim was to make the readers understand Factorial of a Number C Program effectively using comparison!!

2. Ajay Pakhare

I finally learnt how to convert a For Loop into a While Loop in C Programming.

3. Leena Yadav

Can we use separate funtion to write factorial program in C language?

4. Avinash SAWANT

Can we make a library function for factorial of a number c program which cam be used by including header files?

5. Vikramank Singh

Can we find Factorial of a very large integer number using the same code above?

1. Tushar Soni Post author

No. A large integer will require a datatype having larger range than just an int. This code is sufficient only for finding factorial of a normal number.

6. Ashwin Sanghi

Please provide Factorial of Large Numbers in C Programming.

7. Ujjwal Kumar

This program for factorial can contain one additional if loop. Since, the factorial of 1! is 1 and the factorial of 0! is 1, it needs to be implemented in this factorial code too.
if(n == 0 || n == 1)
{
fact = 1;
}

8. Raju Saigal

Best explanation of the factorial of a number in C programming. This has cleared my concepts and especially the loops in C.