public static int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
// call: gcd(17, 13)What is the result?
- Acheck_circle
1
- B
17
- C
13
- D
0
Explanation
17 and 13 are both prime; their gcd is 1.
AP Computer Science A· difficulty 3/5
public static int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
// call: gcd(17, 13)What is the result?
1
17
13
0
Explanation
17 and 13 are both prime; their gcd is 1.
Want 10 more like this — adaptive to your weak spots?