Question: ( V ) Consider following code that computes the factorial of a number? static int factorial ( int n ) { if ) = (

(V) Consider following code that computes the factorial of a number?
static int factorial(int n){
if )=(0
return 1 ;
else
return n**fact(n-1);
}
Explain what would be the result of n=-1
Rewrite the code with Assertion or Exception handling mechanism to protect it from a stupid behavior.
 (V) Consider following code that computes the factorial of a number?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!