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);
Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
Subscribe
Login
0 Comments
Oldest