<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<script type="text/javascript">
//水仙花数
for (var num = 100; num <= 999; num++) { var str = num.toString();
var res1 =Number(str.slice(0,1)) //百位 或者用charAt(0)
var res2 =Number(str.slice(1,2)) //十位 或者用charAt(1)
var res3 =Number(str.slice(2,3)) //个位 或者用charAt(2) var sumcube = Math.pow(res1,3)+Math.pow(res2,3)+Math.pow(res3,3); //立方和
num = res1*100+res2*10+res3; //这个数
if(sumcube == num){
console.log(num);
}
}
</script>
</head>
<body> </body>
</html>

最新文章

  1. Eclipce结合Ant进行编译、打包、传输、运行
  2. 关于break和continue的区别
  3. Python下划线与命名规范
  4. MySQL两种表存储结构MyISAM和InnoDB的性能比较测试
  5. Force StyleCop to Ignore a File
  6. Java基础之创建窗口——使用BoxLayout管理器(TryBoxLayout4)
  7. Spring中使用Jcaptcha实现校验码验证
  8. NSS_09 gridpanel中的actioncolumn事件
  9. MarkDown中锚点的使用
  10. 求模和求余(附加C语言实现)
  11. 重启IIS报错:IIS 服务或万维网发布服务,或者依赖这 服务可能在启动期间发生错误或者已禁用
  12. 警告:‘xxxx’ 将随后被初始化
  13. 轻狂写的桌面日历秀NSIS脚本供大家参考学习
  14. Pass和ClassPath变量配置
  15. Nginx和php是怎么通信的?
  16. 【Linux】安装多个JDK并切换
  17. POSTMAN发送WebService接口
  18. C++ Com控件调用
  19. switch-case最容易忽视的一点
  20. 通过监控Nginx日志来实时屏蔽高频恶意访问的IP

热门文章

  1. bzoj 2286(虚树+树形dp) 虚树模板
  2. 【二分图】【并查集】XVII Open Cup named after E.V. Pankratiev Stage 14, Grand Prix of Tatarstan, Sunday, April 2, 2017 Problem L. Canonical duel
  3. 网络编程之tcp五层模型
  4. android 关于Make sure the plugin is properly configured问题的解决办法
  5. 详解React的生命周期
  6. Ubuntu下查看APT安装的软件安装路径和版本
  7. c#版 mqtt 3.1.1 client 实现
  8. Inno Setup入门(十九)——Inno Setup类参考(5)
  9. Struct2_使用Ajax调用Action方法并返回值
  10. attribute用法