Skip to content

Added java implementation of coprime numbers.#2478

Open
skydans wants to merge 1 commit intoOpenGenus:masterfrom
skydans:java_coprime
Open

Added java implementation of coprime numbers.#2478
skydans wants to merge 1 commit intoOpenGenus:masterfrom
skydans:java_coprime

Conversation

@skydans
Copy link
Contributor

@skydans skydans commented Oct 25, 2017

Fixes issue: #807

Changes:
Added java implementation of coprime numbers.

Copy link
Member

@arnavb arnavb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to read the Java Style Guide!

@@ -0,0 +1,15 @@
class CoprimeNumbers{
public static long gcd(long c,long d){
if(d==0){
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ternary operator could be used here:

return (d == 0) ? c : gcd(d,c%d);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments