153/100 (153-1*100)/10 153-1*100-5*10 */ document.write("100---999之间的水仙花数为:"); document.write("<br>"); for(i = 100; i < 1000;i++){ var num1 = Math.floor(i/100); var num2 = Math.floor((i - num1*100)/10); var num3 = Math.floor(i-(num1*100)-(num2 * 10)); var num =( Math.pow(num1,3)+Math.pow(num2,3)+Math.pow(num3,3)); if( i==num ){ document.write(i + "=" + num1 + "^3" + "+" + num2 + "+" + "^3"+"+"+ + num3 +"^3" + "<br>"); } }