Interview Solution

Up to a point, it is better to just let the snags [bugs] be there than to spend such time in design that there are none. Alan M. Turing

Recursive Factorial

Language Java | Level Intermediate | Category Interview Problems | July 24, 2015 4:52 pm

Comments


Interview Problem

Write a Factorial function using the recursive function.
Write program to find the factorial of the given number using recursive
The factorial of a non-negative integer n, denoted by n!, is the product of all positive integers less than or equal to n. For example,
Example:-
5! = 5 * 4 *3 * 2 * 1 = 120.


Output

   					 
Factorial of '3' is :6

				    

Comments

Posted by secret2006is
March 23, 2016 10:12 am

try: fact( -2 ) ==> Exception in thread "main" java.lang.StackOverflowError



Please login to add comments.