PHP Compiler
<!DOCTYPE html> <html> <body> <?php $num1 = 12; $num2 = 24; $min = ($num1 < $num2) ? $num2: $num1; echo "Common Divisors of $num1 and $num2:<br>"; for($i=1; $i<=$min; $i++) { if(($num1 % $i == 0) && ($num2 % $i == 0)) echo "$i "; } ?> </body> </html>
OUTPUT
Common Divisors of 12 and 24:
1 2 3 4 6 12
×

Save as Private