In the following code that uses recursion to find the greatest common divisor of a number, what is the base case?
```
public static int gcd(int x, int y)
{
if (x % y == 0)
return y;
else
return gcd(y, x % y);
}
```
a. gcd(int x, int y)
b. if (x % y == 0)
return y;
c. else
return gcd(y, x % y);
d. Cannot tell from this code
b. if (x % y == 0)
return y;
Computer Science & Information Technology
You might also like to view...
A proportional typeface has characters that:
A) are the same width. B) vary in width. C) have an absolute position. D) have a relative position.
Computer Science & Information Technology
When you run dcpromo, you must be a ________________ on the server on which you install Active Directory to proceed
a. Domain administrator b. Local administrator c. Backup operator d. LAN administrator
Computer Science & Information Technology