#include <iostream>

using namespace std;

int mcd(int a, int b);
int mcm(int a, int b);

int main(void) {
	int a = 12;
	int b = 18;
	
	cout << "MCD tra " << a << " e " << b << ": " << mcd(a, b) << endl;
	cout << "MCM tra " << a << " e " << b << ": " << mcm(a, b) << endl;
	
	return 0;
}

int mcd(int a, int b) {
	while (b != 0) {
		int temp = b;
		b = a % b;
		a = temp;
	}
	
	return a;
}

int mcm(int a, int b) {
	return (a * b) / mcd(a, b);
}