当前位置:网站首页>打出三位数的所有水仙花数「建议收藏」
打出三位数的所有水仙花数「建议收藏」
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
边栏推荐
- Slf4j打印异常的堆栈信息
- 朋友圈社区程序源码分享
- 300题线性代数 第四讲 线性方程组
- 浏览器tab页之间的通信
- leetcode刷题:栈与队列03(有效的括号)
- Keras machine translation practice
- Myslq ten kinds of locks, an article will take you to fully analyze
- 极客DIY开源方案分享——数字幅频均衡功率放大器设计(实用的嵌入式电子设计作品软硬件综合实践)
- Penetration tools - trustedsec's penetration testing framework (PTF)
- 深度学习 常见的损失函数
猜你喜欢
Niuke programming question -- must brush the string of 101 (brush the question efficiently, draw inferences from one instance)
合成大西瓜小游戏微信小程序源码/微信游戏小程序源码
2022熔化焊接与热切割上岗证题目模拟考试平台操作
杰理之烧录都使用 VBAT 供电,供电电压 4.2V【篇】
芭比Q了!新上架的游戏APP,咋分析?
杰理之、产线装配环节【篇】
On the next generation entrance of the metauniverse -- the implementation of brain computer interface
STC 32-bit 8051 single chip microcomputer development example tutorial three program compilation setting and download
Slf4j打印异常的堆栈信息
[mysql] install mysql5.7
随机推荐
东哥套现,大佬隐退?
How can I know if I want to get the preferential link of stock account opening? Is it safe to open an account online?
Kuberntes云原生实战一 高可用部署架构
目标检测——Yolo系列
What if win11 can't pause the update? Win11 pause update is gray. How to solve it?
三菱PLC FX3U脉冲轴点动功能块(MC_Jog)
What else do you not know about new set()
Comprehensive evaluation and detailed inventory of high-quality note taking software (I) note, obsedian, remnote, flowus
What if the win11 shortcut key switching input method doesn't respond? Shortcut key switching input method does not respond
朋友圈社区程序源码分享
[mysql] install mysql5.7
新牛牛盲盒微信小程序源码_支持流量变现,带完整素材图片
从20s优化到500ms,我用了这三招
【mysql 07】GPG key retrieval failed: “Couldn‘t open file /etc/pki/rpm-gpg/RPM-GPG-KEY-mysql-2022“
大厂做狼,小厂做狗?
RichView 文档中的 ITEM
3D panoramic model display visualization technology demonstration
On the usage of a magic function
Using qeventloop to realize synchronous waiting for the return of slot function
杰理之蓝牙耳机品控和生产技巧【篇】