Java icon indicating copy to clipboard operation
Java copied to clipboard

GCD.java placed in Others package doesn't work right

Open MarisaAfuera opened this issue 8 years ago • 7 comments

Greatest divisor common algorithm coded in GDC.java doesn't work when the numbers into the array are arranged in ascending order. I mean, the function gcd(int num1, int num2) works right if the call is gdc(40,24) but doesn't work if the call is gdc(24,40).

MarisaAfuera avatar Jul 25 '18 14:07 MarisaAfuera

@MarisaAfuera Thanks for bug report. I jump right in.

christianbender avatar Jul 25 '18 14:07 christianbender

@MarisaAfuera It works for none of this cases: (24,40) or (40,24) I get various outputs but none of it is correct. The correct answer is 8.

christianbender avatar Jul 25 '18 15:07 christianbender

@MarisaAfuera

he function gcd(int num1, int num2) works right

No. In this method is the bug. See my comments above.

christianbender avatar Jul 25 '18 15:07 christianbender

@MarisaAfuera I fixed it.

christianbender avatar Jul 25 '18 15:07 christianbender

Hi Christian,

I'm novice in github. I'm looking for contribute making some code. It doen't matter new code or fixing old one. If I can help you in any way, I'm willing.

Sincerely

Marisa Afuera

2018-07-25 17:08 GMT+02:00 Christian Bender [email protected]:

Closed #471 https://github.com/TheAlgorithms/Java/issues/471.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TheAlgorithms/Java/issues/471#event-1752858112, or mute the thread https://github.com/notifications/unsubscribe-auth/ASac7M313xkAzvv0fjIyZLral_2wE43Eks5uKIoCgaJpZM4VgOu9 .

MarisaAfuera avatar Jul 25 '18 15:07 MarisaAfuera

@MarisaAfuera Oh. Sorry. You can fix code style issues in the code of the implemented algorithms and data structures. Many files in this repository have an bad style. Orient you on the Java code sytle conventions Feel free and make a pull request. One pull request per file.

christianbender avatar Jul 25 '18 21:07 christianbender

Ok. I'll work in order to improve the code.

Marisa

El mié., 25 jul. 2018 23:28, Christian Bender [email protected] escribió:

@MarisaAfuera https://github.com/MarisaAfuera Oh. Sorry. You can fix code style issues in the code of the implemented algorithms and data structures. Many files in this repository have an bad style. Orient you on the Java code sytle conventions https://www.oracle.com/technetwork/java/javase/overview/codeconvtoc-136057.html Feel free and make a pull request. One pull request per file.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/TheAlgorithms/Java/issues/471#issuecomment-407901752, or mute the thread https://github.com/notifications/unsubscribe-auth/ASac7ModbdKedZ77ThM5AQLkB3euHNV6ks5uKOL-gaJpZM4VgOu9 .

MarisaAfuera avatar Jul 25 '18 21:07 MarisaAfuera