<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
</html>
<script type="text/javascript"> for(i=100;i<1000;i++){
var a = parseInt(i%10);
var b = parseInt((i/10)%10);
var c = parseInt(i/100);
if(a*a*a+b*b*b+c*c*c==i){
document.write(i + "水仙花数"+"<br/>");
}
} </script>

JS 1000以内的水仙花数 (三位数 各个数字的立方和等于本身 例如 1*1*1 + 5*5*5 + 7*7*7 = 157)的更多相关文章

  1. 使用js输出1000以内的水仙花数

    什么是水仙花数 水仙花数(Narcissistic number)也被称为超完全数字不变数(pluperfect digital invariant, PPDI).自恋数.自幂数.阿姆斯壮数或阿姆斯特 ...

  2. 【C语言】创建一个函数,判断某一正整数是否为水仙花数,并调用这个函数找出1000以内所有水仙花数

    #include <stdio.h> int fun(int x) { int a, b, c; a = x / ; b = x % / ; c = x % ; if (x == a * ...

  3. java求1000以内的水仙花数

    水仙花数是指一个 n 位数 ( n>=3 ),它的每个位上的数字的 n 次幂之和等于它本身.(例如:1^3 + 5^3 + 3^3 = 153) 三位的水仙花数共有4个,分别为:153.370. ...

  4. 【C语言】找出1000以内的水仙花数

    什么是水仙花数? 水仙花数是指一个 3 位数,它的每个位上的数字的 3次幂之和等于它本身(例如:1^3 + 5^3+ 3^3 = 153). 代码1: #include<stdio.h> ...

  5. 【C语言】(for循环嵌套)找出1000以内的水仙花数

    什么是水仙花数? 水仙花数是指一个 3 位数,它的每个位上的数字的 3次幂之和等于它本身(例如:1^3 + 5^3+ 3^3 = 153). 分析: 根据定义可知: a*a*a+b*b*b+c*c*c ...

  6. Demo02一千以内的水仙花数

    package 习题集2;//1000以内的水仙花数public class Demo02 { public static void main(String[] args) { int i = 100 ...

  7. 编写一个Java应用程序,该应用程序包括2个类:Print类和主类E。Print 类里有一个方法output()功能是输出100 ~ 999之间的所有水仙花数(各位数字的 立方和等于这个三位数本身,如: 371 = 33 + 73 + 13。)在主类E的main方法中来 测试类Print

    package zuoye; public class print { void output() { System.out.println("100-999之间的水仙花数是:") ...

  8. Python输出三位数以内的水仙花数

    num = 100 while num <= 999: a = num % 10 #取个位数 b = num // 10 % 10 #取十位数 c = num // 100 #取百位数 if n ...

  9. 6.编写一个Java应用程序,该应用程序包括2个类:Print类和主类E。Print 类里有一个方法output()功能是输出100 ~ 999之间的所有水仙花数(各位数字的 立方和等于这个三位数本身,如: 371 = 33 + 73 + 13。)在主类E的main方法中来 测试类Print。

    Print类: package com.bao; public class Print { int g,s,b; void outPut() { for(int i=100;i<1000;i++ ...

随机推荐

  1. Codeforces 902D/901B - GCD of Polynomials

    传送门:http://codeforces.com/contest/902/problem/D 本题是一个数学问题——多项式整除. 对于两个整数a.b,求最大公约数gcd(a,b)的辗转相除法的函数如 ...

  2. Java设计模式之 — 组合(Composite)

    转载请注明出处:http://blog.csdn.net/guolin_blog/article/details/9153753 听说你们公司最近新推出了一款电子书阅读应用,市场反应很不错,应用里还有 ...

  3. jQuery动态效果

    1.一号店首页 2.淘宝网购物车

  4. Nginx学习总结(1)——Nginx入门简介

    本文主要介绍一些Nginx的最基本功能以及简单配置,但不包括Nginx的安装部署以及实现原理.废话不多,直接开始. 1.静态HTTP服务器 首先,Nginx是一个HTTP服务器,可以将服务器上的静态文 ...

  5. adchos 文本混淆工具

    #-*- coding:utf-8 -*- import jieba import random import codecs import sys import string import chard ...

  6. hdu 1011 树型dp

    #include <cstdio> #include <iostream> #include <cstring> #include <vector> u ...

  7. Java中Void占位符的測试及个人理解

    Java对Void类的说明是:Void 类是一个不可实例化的占位符类,它保持一个对代表 Java keyword void 的 Class 对象的引用. 代表的是: 代表主要的 Java 类型 voi ...

  8. webbench压力測试工具

    apache的測试工具ab 在并发100个以上后会出现错误.网上也有非常多改ab源代码来解禁的. 只是还是推荐一款比較好用的压力測试工具webbench wget http://blog.zyan.c ...

  9. Php socket数据编码

    bytes.php  字节编码类 /** * byte数组与字符串转化类 * @author * created on 2011-7-15 */ class bytes { /** * 转换一个str ...

  10. c15--二位数组

    // // main.c // day08 #include <stdio.h> int main(int argc, const char * argv[]) { /* int scor ...