Website Summary Files Commits Branches @commit @diff @stats
path: root / Week13 / Exercise16.cpp
blob: 66f8e114019552efde953dea7a085040043f5c80 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

unsigned gcd(unsigned a, unsigned b) {
	if (a == b)
		return a;
	else if (a < b)
		return gcd(b, a);
	else
		return gcd(a - b, b);
}

int main() {
	unsigned a, b;
	std::cin >> a >> b;

	std::cout << gcd(a, b) << std::endl;

	return 0;
}