Recursion

AP Computer Science A· difficulty 4/5

gcd(12, 18) by Euclid: gcd(12,18) = gcd(18,12%18) = gcd(18,12) = gcd(12,18%12) = gcd(12,6) = gcd(6,12%6) = gcd(6,0) = ?

  • A

    6

    check_circle
  • B

    2

  • C

    12

  • D

    1

Explanation

GCD(12,18) = 6.

Want 10 more like this — adaptive to your weak spots?

Related questions