In C++, std::lcm() method has already defined in numeric header. You can use.
#include <numeric>
#include <iostream>
int main(int argc, char* argv[]) {
//User variables.
int x,y; std::cin>>x>>y;
//Print the result by using std::lcm method in numeric header.
std::cout << std::lcm(x,y) << std::endl;
return 0;
}