+ 2

Write a program to print the common division of any two given numbers?

1st Apr 2018, 8:59 AM
Shamsulhaq Alkozay
Shamsulhaq Alkozay - avatar
2 Answers
+ 4
Euclidean and binary GCD algorithms written in Java (this was a while back): https://code.sololearn.com/cSmM1BVjMiHO/?ref=app https://code.sololearn.com/cFmKZ0d9XELk/?ref=app
1st Apr 2018, 9:32 AM
LunarCoffee
LunarCoffee - avatar
+ 3
I think you mean Common Divisor (also known as the Greatest Common Divisor), and not Common Division. I wrote this for you (it's based on the Binary Method, as taken from https://en.wikipedia.org/wiki/Greatest_common_divisor#Binary_method) Here is my code: https://code.sololearn.com/crhhi243FNgN Any questions, please let me know. *** Apologies! Only just noticed one of your tags says Java! LunarCoffee's solution looks fantastic for Java. I'll leave my code up in C++, in case anybody else finds that useful.
1st Apr 2018, 10:05 AM
Emma