Recursive Method Termination
Consider the findFactorial method below.
public int findFactorial(int n)
{
if (n <= 1)
return 1;
else
return n * findFactorial(n - 1);
}
For which integer values of n will the method terminate without error?
A
For any non-negative integer input
B
Only for input values greater than 1
C
Only when the input is a negative number
D
It will not terminate without error for any input
Question Leaderboard
Not enough data yet to show leaderboard.
APFIVE