Interview Solution

If McDonalds were run like a software company, one out of every hundred Big Macs would give you food poisoning, and the response would be, ‘We’re sorry, here’s a coupon for two more.’ “ Mark Minasi

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.