Skip to content

Instantly share code, notes, and snippets.

@anuradhawick
Created November 13, 2014 13:22
Show Gist options
  • Save anuradhawick/bc4baef963dce591a1f2 to your computer and use it in GitHub Desktop.
Save anuradhawick/bc4baef963dce591a1f2 to your computer and use it in GitHub Desktop.
GCD/ HCF/ highest common factor for two numbers recursive
int gcd(int a,int b){
if (a>b){
if(b==0){
return a;
}
else{
return gcd(b,a%b);
}
}
else{
if(a==0){
return b;
}
else{
return gcd(a,b%a);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment