Factorial Using Recursion
Easyjavapythonccppjavascript
Given a non-negative integer N, compute N! (the product of all integers from 1 to N; 0! = 1).
Input Format
A single line containing the integer N.
Output Format
Print N!.
Example 1
Input
5
Output
120
Explanation: 5! = 5 * 4 * 3 * 2 * 1 = 120.
- 0 <= N <= 20
Submit an attempt to unlock the solution. (Sign in first.)
Related Problems
- Fibonacci NumberEasy · java, python, c, cpp, javascriptSolve Problem
- Power Using RecursionEasy · java, python, c, cpp, javascriptSolve Problem
- Generate All SubsetsMedium · java, python, c, cpp, javascriptSolve Problem