Can anyone help me, I have no idea how to find the lowest common multiple.
For example with the numbers 4 and 5 which is 20. This is what I want to achieve in code.
Thank you
Can anyone help me, I have no idea how to find the lowest common multiple.
For example with the numbers 4 and 5 which is 20. This is what I want to achieve in code.
Thank you
This isn't the best solution but it is a solution see the links in the replies for better solutions
b = 4;
a = 5;
for(int i = 1; i <= b; i++) {
if(i*a % b == 0)
return abs(i*a);
}
Thanks iamnotmaynard for the suggestion