Interview Solution

There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. C.A.R. Hoare

Recursive Factorial

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


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,
5! = 5 * 4 *3 * 2 * 1 = 120.


Factorial of '3' is :6



Posted by secret2006is
March 23, 2016 10:12 am

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

Please login to add comments.