// Greatest Common Divisor Calculator
// By DreamVB 23:55 20/10/2016

#include <iostream>

using namespace std;
using std::cout;
using std::endl;

int gcd(int a, int b){
	//Calc Greatest Common Divisor
	if (a == 0){ return b; }
	if (b == 0){ return a; }

	if (a < b)
		return gcd(a, b % a);
	return gcd(b, a % b);
}

int main(int argc, char *argv[]){
	int a = 0;
	int b = 0;

	cout << "Greatest Common Divisor Calculator" << endl;
	cout << "Enter first number  : ";
	cin >> a;
	cout << "Enter second number : ";
	cin >> b;

	cout << endl << "The Greatest Common Divisor of a and b is : " << gcd(a, b) << endl;

	system("pause");
	return 0;
}