js查询自幂数

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
     for(var num=100;num<1000;num++){
        var a=parseInt(num/100);
        var b=num%10
        var c=parseInt(num/10)%10
        if(a*a*a+b*b*b+c*c*c===num){
            console.log(num+'是自幂数')
        }
     }
      
    </script>
</body>
</html>
posted @ 2020-10-27 20:28  无敌臭弟弟  阅读(73)  评论(0编辑  收藏  举报