Example 28: Factorial of a Number

Learn how to calculate the factorial of a number.


Write a program to find the factorial value of any number.


Input Output
5 120
7 5040
15 1307674368000
19 121645100408832000

Try it yourself

Try to solve this question on your own in the code widget below. If you get stuck, you can always refer to the solution provided.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.