PHP Compiler
<!DOCTYPE html> <html> <body> <?php $num1 = 45; $num2 = 90; $gcd = 1; for($i=2; $i<=$num1 && $i<=$num2; $i++) { // Checks if i is factor of both integers if(($num1 % $i == 0) && ($num2 % $i == 0)) $gcd = $i; } echo "GCD of $num1 and $num2: $gcd <br>"; ?> </body> </html>
OUTPUT
GCD of 45 and 90: 45
×

Save as Private