Skip to content

Instantly share code, notes, and snippets.

@theanam
Created September 29, 2015 09:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save theanam/233427978585d1e38951 to your computer and use it in GitHub Desktop.
Save theanam/233427978585d1e38951 to your computer and use it in GitHub Desktop.
Euclid's algorithm for finding GCD
function gcd(a,b){
if(a==0 || b==0){
return a;
}
else{
return gcd(b,a%b);
}
}
//test
console.log(gcd(10,45));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment