import java.util.Scanner;
public class Test3 {
public boolean run(int num){
// 判断值是否为水仙花数 是水仙花数则返回true 否则为false
return num==Math.pow(num%10,3)+Math.pow(num/10%10,3)+Math.pow(num/100,3)? true:false;
}
public static void main(String[] args) {
System.out.println("请输入一个三位数");
Scanner scanner = new Scanner(System.in);
System.out.println(new Test3().run(scanner.nextInt()));
}
}
09-02
3148
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-17
1884
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
06-04
5368
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
07-14