当前位置:网站首页>打出三位数的所有水仙花数「建议收藏」
打出三位数的所有水仙花数「建议收藏」
2022-07-01 20:21:00 【全栈程序员站长】
大家好,又见面了,我是你们的朋友全栈君。
/**
* 题目:打印出所有的 "水仙花数 ",所谓 "水仙花数 "是指一个三位数,
* 其各位数字立方和等于该数本身。例如:153是一个 "水仙花
* 数 ",因为153=1的三次方+5的三次方+3的三次方
*/
public class 水仙花数 {
public static void main(String[] args) {
for (int i = 100; i < 1000; i++) {
int first = i/100;
int secode= i/10%10;
int thrid = i%10;
if (first*first*first+secode*secode*secode+thrid*thrid*thrid == i) {
System.out.println(i+"是水仙花数");
}
}
}
}
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/147187.html原文链接:https://javaforall.cn
边栏推荐
- 十三届蓝桥杯B组国赛
- Face recognition system opencv face detection
- 【Opencv450】HOG+SVM 与Hog+cascade进行行人检测
- 新版图解网络PDF即将发布
- Customize the insertion of page labels and realize the initial search of similar address books
- 【opencv】train&test HOG+SVM
- leetcode刷题:栈与队列03(有效的括号)
- 杰理之关于长按开机检测抬起问题【篇】
- How to connect the two nodes of the flow chart
- 朋友圈社区程序源码分享
猜你喜欢
随机推荐
联想电脑怎么连接蓝牙耳机?
最近公共祖先(LCA)在线做法
杰理之、产线装配环节【篇】
九章云极DataCanvas公司蝉联中国机器学习平台市场TOP 3
Detailed explanation and code example of affinity propagation clustering calculation formula based on graph
Richview trvdocparameters page parameter settings
网上开户是安全的吗?新手可以开炒股账户吗。
考虑关系的图卷积神经网络R-GCN的一些理解以及DGL官方代码的一些讲解
Items in richview documents
2022年高处安装、维护、拆除考题模拟考试平台操作
Niuke programming question -- must brush the string of 101 (brush the question efficiently, draw inferences from one instance)
Exclusive news: Alibaba cloud quietly launched RPA cloud computer and has opened cooperation with many RPA manufacturers
架构师毕业总结
小鸟逃票登机,如何反思,应如何解决,飞机为何怕小鸟?
Target detection - Yolo series
300 linear algebra Lecture 4 linear equations
关联线探究,如何连接流程图的两个节点
2022年低压电工考试试题及答案
薛定谔的日语学习小程序源码
EDA工具对芯片产业的重要性知识科普