Class IX · NCERTShort answermedium Sign in for help
Ch 11 · The World of Algorithms · Exercise Set 11.2 · 9 of 12 in this chapter
Let , .
–
– Initially set most-recent-common-divisor to 1
– k = 2 divides both 6 and 12. Update: most-recent-common-divisor to 2.
– k = 3 divides both 6 and 12. Update: most-recent-common-divisor to 3.
– k = 4 doesnot divide 6. most-recent-common-divisor remains 3.
– k = 5 doesnot divide 6. most-recent-common-divisor remains 3.
– k = 6 divides both 6 and 12. Update: most-recent-common-divisor to 6.
Scan complete. gcd(6, 12) = 6
–
– Initially set most-recent-common-divisor to 1
– k = 2 divides both 6 and 12. Update: most-recent-common-divisor to 2.
– k = 3 divides both 6 and 12. Update: most-recent-common-divisor to 3.
– k = 4 doesnot divide 6. most-recent-common-divisor remains 3.
– k = 5 doesnot divide 6. most-recent-common-divisor remains 3.
– k = 6 divides both 6 and 12. Update: most-recent-common-divisor to 6.
Scan complete. gcd(6, 12) = 6
- Book
- NCERT
- Exercise
- Set 11.2
- Hints
- 3
- Solution
- Locked
- Topics
- GcdWorked example