#include <iostream>
// Function to calculate the greatest common divisor (GCD) of two numbers
int gcd(int a, int b) {
if (b == 0) {
return a;
} else {
return gcd(b, a % b);
}
}
// Function to calculate the least common multiple (LCM) of two numbers
int lcm(int a, int b) {
return (a * b) / gcd(a, b);
}
int main() {
// Example usage of the lcm function
int num1 = 12;
int num2 = 18;
int result = lcm(num1, num2);
// Display the result
std::cout << "LCM of " << num1 << " and " << num2 << " is: " << result << std::endl;
return 0;
}