0

Find Lcm of two numbers using java

take two numbers has input

21st Feb 2018, 5:37 PM
Rathnakar Reddy
Rathnakar Reddy - avatar
3 Réponses
0
If you know how to find GCD of two numbers a, b, LCM can be found by (a*b)/GCD(a,b)
21st Feb 2018, 6:07 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar
0
I want without gcd
21st Feb 2018, 6:12 PM
Rathnakar Reddy
Rathnakar Reddy - avatar
0
Take maximum of the two numbers and continue producing the multiples of this number until it is also the multiple of smaller number. Or there is another tedious method of finding prime factors of both numbers and union them. product of all union numbers gives you LCM.
21st Feb 2018, 7:11 PM
Ravi Chandra Enaganti
Ravi Chandra Enaganti - avatar