Solved

Rewrite the Following Iterative Method as a Recursive Method That

Question 29

Essay

Rewrite the following iterative method as a recursive method that computes the same thing. NOTE: your recursive method will require an extra parameter.
public int iterative1(int x)
{
int count = 0, factor = 2;
while (factor < x)
{
if (x % factor = = 0) count++;
factor++;
}
return count;
}

Correct Answer:

verifed

Verified

public int recursion1(int x, i...

View Answer

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

Related Questions