Javatpoint Logo
Javatpoint Logo

Factorial Program in C

Factorial Program in C: Factorial of n is the product of all positive descending integers. Factorial of n is denoted by n!. For example:

Here, 5! is pronounced as "5 factorial", it is also called "5 bang" or "5 shriek".

The factorial is normally used in Combinations and Permutations (mathematics).

There are many ways to write the factorial program in c language. Let's see the 2 ways to write the factorial program.

  • Factorial Program using loop
  • Factorial Program using recursion

Factorial Program using loop

Let's see the factorial Program using loop.

Output:

Enter a number: 5
Factorial of 5 is: 120

Factorial Program using recursion in C

Let's see the factorial program in c using recursion.

Output:

Enter a number: 6
Factorial of 5 is: 720




Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA