ProgrammingHardTCS NQT · Infosys

What is gcd(48, 180) by Euclid's recursion?

  1. A. 6
  2. B. 12
  3. C. 24
  4. D. 4

Correct answer: B. 12

180 mod 48 = 36, 48 mod 36 = 12 and 36 mod 12 = 0, so the gcd is 12. Each step replaces the pair with (b, a mod b).

More C Programming questions

Exams that ask this topic