The need to find the Icm is pretty common in C++ programming. This is just a basic code for finding the lcm of two integers:
int lcm(int large, int small){ int max = large * small; // % until max int mult = large; // will address lcm int factor = 2; // large * factor until lcm while ((mult % small) && (mult <= max)) { mult = large * factor; factor++; } return mult;}