# Find Factorial of Number C Program

## 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.

#### Tushar Soni

I am Tushar Soni, Co - Founder of CodingAlpha. I am a computer science student from India and passionate about Web Development and Programming. Connect with me on Facebook | LinkedIn | Google Plus

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

• July 31, 2016 at 1:23 pm

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

• July 31, 2016 at 10:10 pm

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

• July 31, 2016 at 4:14 pm

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

• August 20, 2016 at 3:50 pm

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

• August 20, 2016 at 4:18 pm

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

• September 10, 2016 at 2:40 am

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

• September 10, 2016 at 2:44 am

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.

• September 10, 2016 at 2:53 am

Please provide Factorial of Large Numbers in C Programming.

• November 4, 2016 at 8:13 pm

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;
}