public class NumberPuzzle3 { public static void main(String[] args) { int n, y; for (int x = 1; x <= 9; x++) { for (n = 0; n <= 9; n++) { for (y = 0; y <= 9; y++) { if (((x * x * x) + (n * n * n) + (y * y * y)) == ((x * 100) + (n * 10) + y)) System.out.print(x + "" + n + "" + y + "\n"); } y -= 9; } n -= 9; } } }