Assignemnt #119 Number Puzzles IV: A New Hope
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Number Number Puzzles IV: A New Hope
///File Name: NP4.java
///Date: 5/8/2016
public class NP4
{
public static void main(String[] args)
{
for (int a = 0; a < 46; a++)
{
for (int b = 0; b < 46; b++)
{
for (int c = 0; c < 46; c++)
{
for (int d = 0; d < 46; d++)
{
int sum = a + b + c + d;
int eA = a + 2;
int eB = b - 2;
int eC = c * 2;
int eD = d / 2;
if (eA == eB && eB == eC && eC == eD && sum == 45)
{
System.out.println(a + ", " + b + ", " + c + ", " + d);
}
}
}
}
}
}
}
Picture of the output