aboutsummaryrefslogtreecommitdiffstats
path: root/C++/Euclid.cpp
blob: b2daaaa615c3dcf13bda6290ef8822d69116dccb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>
#include <cmath>

using namespace std;

int mgcd(int a, int b) {
	if(a % b != 0) {
		mgcd(b, a % b);
	} else {
		cout << "\nGreatest common divisor: " << b  << endl;
	}	
}

int main() {
	int x, y;
	cout << "Enter 2 numbers: ";
	cin >> x >> y;
	mgcd(x, y);
}