On this tutorial page we are going to learn how to write a Java program to find Factorial Number.

A factorial number is the product of all positive integers from 1 to a given number. For example, the factorial of 5 is 5 x 4 x 3 x 2 x 1 = 120. The symbol used to represent the factorial operation is an exclamation mark (!). So, 5! is read as "five factorial" and is equal to 120.

Program 1: Find the factorial of a number in Java using while loop

Output

Factorial of 5 = 120

Program 2: Find the factorial of a number in Java using for loop

Output

Factorial of 5 = 120

Program 3: Find the factorial of a number in Java using Scanner class (user input)

Output

Enter the number: 5 Factorial of 5 = 120

That's all guys, hope this Java Program is helpful for you.

Happy Learning... 😀

Please share this article on social media to help others.

If you have any query or suggestion regarding this artical please share with us feedback@javabytechie.com