Highest Common Factor 最大公因子 & Lowest Common Multiple 最小公倍数


First Integer:
Second Integer:

Highest Common Factor =
Lowest Common Multiple =

<SCRIPT><!--
function calculate()
{var x = document.myform.a.value,
y = document.myform.b.value, remainder

while (remainder != 0)
{
remainder = x%y
x = y
y = remainder
} //end of while
document.myform.hcf.value = x
document.myform.lcm.value = document.myform.a.value * document.myform.b.value/x

} //end of function calculate

//--></SCRIPT>