Assignemnt #119 and Number Puzzles A New Hope
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Number Puzzles A New Hope
///File Name: NumberPuzzlesANewHope
///Date Finished: 3/24/16
public class NumberPuzzlesANewHope
{
public static void main( String[] args )
{
System.out.println(" ");
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 summ = a + b + c + d;
int add = a + 2;
int minus = b - 2;
int multi = c * 2;
int divide = d / 2;
if( summ == 45 && add == minus && minus == multi && multi == divide )
{
System.out.println( a + ", " + b + ", " + c + ", " + d );
}
}
}
}
}
System.out.println(" ");
}
}
Picture of the output