public class Exercise3_2 {
public static void main(String[] args) {
for(int i = 100; i < 1000; i++) {
if (Math.pow(i / 100, 3) + Math.pow((i % 100) / 10, 3) + Math.pow(i % 10, 3) == i) {
System.out.println(Math.pow(i / 100, 3));
System.out.println(Math.pow(i % 100, 3));
System.out.println(Math.pow(i % 10, 3));
System.out.printf("%d %n%n", i);
}
}
}
}
--------8<--------8<--------8<--------8<----
1.0
125.0
27.0
153
27.0
343.0
0.0
370
27.0
343.0
1.0
371
64.0
0.0
343.0
407
-------->8-------->8-------->8-------->8----