for3 —— 水仙花数
2018-12-11 本文已影响0人
浮_屠
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>水仙花</title>
<script type="text/javascript">
for (var i = 100 ; i <= 1000; i++) {
var b = parseInt(i/100);
var s = parseInt((i-b*100)/10);
var g = i%10;
if(b**3 + s**3 + g**3 == i){
alert(i)
}
}
</script>
</head>
<body>
</body>
</html>