Skip to content

Instantly share code, notes, and snippets.

@Baekjoon Baekjoon/gcd.cc
Created Sep 27, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.