lcm recursive program in c++

#include <iostream>

// Function to calculate the greatest common divisor (GCD)
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)
int lcm(int a, int b) {
    return (a * b) / gcd(a, b);
}

int main() {
    // Input values
    int num1, num2;
    std::cout << "Enter two numbers: ";
    std::cin >> num1 >> num2;

    // Calculate and display the LCM
    std::cout << "LCM of " << num1 << " and " << num2 << " is: " << lcm(num1, num2) << std::endl;

    return 0;
}