在这里插入代码片
```public class test {
private static void flower() {
for (int i = 100; i < 1000; i++) {
int a = i / 100;
int b = (i / 10) % 10;
int c = i % 10;
if(i==Math.pow(a,3)+Math.pow(b,3)+Math.pow(c,3)) {
System.out.println(i);
}
}
}
public static void main(String[] args) {
flower();
}
}
【Java】求1~1000中所有的水仙花数
最新推荐文章于 2022-06-15 18:49:44 发布