Solved

Here Is a Recursive Function That Is Supposed to Return

Question 34

Essay

Here is a recursive function that is supposed to return the factorial.Identify the line(s)with the logical error(s).Hint: This compiles and runs,and it computes something.What is it?
int fact( int n )//a
{
int f = 1;//b
if ( 0 == n || 1 == n )//c
return f;//d
else
{
f = fact(n - 1);//f
f = (n-1)* f;//g
return f;//h
}
}

Correct Answer:

verifed

Verified

The function computes (n-1)! T...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents