function findLCM($a, $b) {
return ($a * $b) / gcd($a, $b);
}
function gcd($a, $b) {
while ($b != 0) {
$temp = $b;
$b = $a % $b;
$a = $temp;
}
return $a;
}
// Example usage:
$num1 = 12;
$num2 = 18;
echo "LCM: " . findLCM($num1, $num2);
Limited Time Offer!
For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!
Subscribe
Login
0 Comments
Oldest