Assignment #119 Number Puzzles IV: A New Hope
Code
///Name: Ian Grant
///Period:5
///Project Name: Number Puzzles IV: A New Hope
///File Name:Puzz4.java
///05/25/16
public class Puzz4
{
public static void main (String [] args)
{
for (int q = 1; q < 500; q++)
{
for (int w = 1; w < 500; w++)
{
for (int e = 1; e< 500; e++)
{
for (int r = 1; r < 500; r++)
{
int total = (q+w+e+r);
int a = q + 2;
int b = w - 2;
int c = e * 2;
int d = r / 2;
if (total == 45 && a==b && b==c && c==d)
{
System.out.println(q + " " + w + " " + e + " " + r);
}
}
}
}
}
}
}
Output