var x=120, y=66; while (y != 0) { var t = x % y; x = y; y = t; document.write("x="+x+",y="+y+"<br>"); } document.write("最大公約数は"+x);