+ 4

How to get Greatest Common Divisor of Two numbers in Java on your own solving technique

How to get Greatest Common Divisor of Two numbers in Java on your own solving technique i think there is so many possible code to get GCD of 2 numbers can you show me some technique ?

8th Dec 2017, 3:09 AM
John Nehry C. Dedoro
John Nehry C. Dedoro - avatar
2 Respuestas
+ 3
let the function gcd be: if (a==0){ return b; } elif (b==0){ return a; } else{ return gcd(a%b,(a>b)?b:a)
8th Dec 2017, 3:26 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
thanks for that sir @Pegasus
8th Dec 2017, 3:36 AM
John Nehry C. Dedoro
John Nehry C. Dedoro - avatar