function printDaffodilNumber(){ document.write("Print out all daffodil number: " + "<br/>"); for (var num =100 ; num <1000 ; num++) { var a = num % 10; var b = parseInt((num / 10) % 10); var c = parseInt(num / 100); //判断是否是水仙花数,并输出 if(num == a*a*a+b*b*b+c*c*c){ document.write(num+"<br/>"); } } } printDaffodilNumber(); function num(a,b){ var c=a*b; return c; } var result=num(5,6); document.write(result);