当前位置:网站首页>打出三位数的所有水仙花数「建议收藏」
打出三位数的所有水仙花数「建议收藏」
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
边栏推荐
- 编程英语生词笔记本
- On the usage of a magic function
- 合成大西瓜小游戏微信小程序源码/微信游戏小程序源码
- 薛定谔的日语学习小程序源码
- 《軟件工程導論(第六版)》 張海藩 複習筆記
- Uniapp uses Tencent map to select points without window monitoring to return users' location information. How to deal with it
- 实战项目笔记(一)——虚拟机的创建
- Items in richview documents
- There are four ways to write switch, you know
- 架构师毕业总结
猜你喜欢
目標檢測——Yolo系列
开环和闭环是什么意思?
Richview trvdocparameters page parameter settings
随机头像大全,多分类带历史记录微信小程序源码_支持流量主
新版图解网络PDF即将发布
Uniapp uses Tencent map to select points without window monitoring to return users' location information. How to deal with it
8K HDR!| Hevc hard solution for chromium - principle / Measurement Guide
Exclusive news: Alibaba cloud quietly launched RPA cloud computer and has opened cooperation with many RPA manufacturers
Detailed explanation and code example of affinity propagation clustering calculation formula based on graph
强大的万年历微信小程序源码-支持多做流量主模式
随机推荐
What if win11 can't pause the update? Win11 pause update is gray. How to solve it?
新牛牛盲盒微信小程序源码_支持流量变现,带完整素材图片
leetcode刷题:栈与队列04(删除字符串中的所有相邻重复项)
以飞地园区为样本,看雨花与韶山如何奏响长株潭一体化发展高歌
300题线性代数 第四讲 线性方程组
杰理之关于长按开机检测抬起问题【篇】
Face recognition system opencv face detection
2022年低压电工考试试题及答案
Accelera Systems Initiative是一个独立的非营利组织
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
Learn white box test case design from simple to deep
Penetration tools - trustedsec's penetration testing framework (PTF)
东哥套现,大佬隐退?
人脸识别系统 —— OpenCV人脸检测
浏览器tab页之间的通信
leetcode刷题:二叉树03(二叉树的后序遍历)
【let var const】
EURA eurui E1000 series inverter uses PID to realize the relevant parameter setting and wiring of constant pressure water supply function
Common components of flask