summaryrefslogtreecommitdiff
path: root/PlaygroundCpp/Sources/Playground.cpp
blob: 29861405af050c1f44d9904a60e0237ec5361249 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <iostream>
//#include <gtest/gtest.h>

static int getGCD(int a, int b) {
	if (b == 0) {
		return a;
	}

	if (b > a) {
		return getGCD(b, a);
	} else {
		return getGCD(b, a % b);
	}
}
static long getLCM(int a, int b) {
	// https://www.idomaths.com/hcflcm.php#formula
	return (long) a * (long) b / (long) getGCD(a, b);
}

//TEST(LCMTest, Zero) {
//	ASSERT_EQ(getLCM(6, 8), 24);
//}
//
//TEST(LCMTest, One) {
//	ASSERT_EQ(getLCM(28851538, 1183019), 1933053046);
//}
//
//TEST(LCMTest, Two) {
//	ASSERT_EQ(getLCM(14159572, 63967072), 226436590403296);
//}

int main() {
	int a, b;
	std::cin >> a;
	std::cin >> b;
	long c = getLCM(a, b);
	std::cout << c << '\n';
}