Skip to content

Instantly share code, notes, and snippets.

@Baekjoon
Created September 27, 2015 14:55
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 Baekjoon/35103b4614ad7e192e18 to your computer and use it in GitHub Desktop.
Save Baekjoon/35103b4614ad7e192e18 to your computer and use it in GitHub Desktop.
GCD
#include <iostream>
int gcd(int x, int y) {
if (y == 0) {
return x;
} else {
return gcd(y, x%y);
}
}
int main() {
std::cout << gcd(24, 16) << '\n';
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment