Assignment #119 Number Puzzles IV: A New Hope
Code
/// Name: Koosha Kimelman
/// Period: 7
/// Program Name: Number Puzzles IV: A New Hope
/// File Name: NumberPuzzle4.java
/// Date Completed: 4/22/16
public class NumberPuzzle4 {
public static void main(String[] args) {
int n, y, z;
for (int x = 1; x <= 25; x++) {
for (n = 1; n <= 25; n++) {
for (y = 1; y <= 25; y++) {
for (z = 1; z <= 25; z++) {
if (((x + n + y + z) == 45) && (x + 2 == n - 2) && (x + 2 == y * 2) && (x + 2 == z / 2))
System.out.println(x + " " + n + " " + y + " " + z);
}
z -= 24;
}
y -= 24;
}
n -= 24;
}
}
}
Picture of the output