打印出100--999以内的所有 "水仙花数 ",所谓 "水仙花数 "是指一个三位数, 其各位数字立方和等于该数本身

for (var i = 100; i <= 999; i++) {
var it = i + “”;
if (it[0] ** 3 + it[1] ** 3 + it[2] ** 3 == i) {
console.log(i)
}
}

猜你喜欢

转载自blog.csdn.net/weixin_43748930/article/details/85073771