Finding GCD | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Finding GCD

How can I find greatest common divisor using recursion in java ?I tried a lot of times and could not think of any algorithm. Thanks in advance.

25th Jul 2020, 6:46 AM
H-J
H-J - avatar
1 Answer
+ 3
Use Euclid algorithm GCD(a, 0) =a Try to make b shorter by dividing b by a using recursion
25th Jul 2020, 7:37 AM
Aayush $aini
Aayush $aini - avatar