Assignment #119 and Number Puzzles IV: A New Hope
Code
///Name: Ali Kurland
/// Period: 6
/// Program Name: Number Puzzles IV: A New Hope
/// File Name: PuzzleIV.java
/// Date Finished: 4/15/2016
public class PuzzleIV
{
public static void main( String[] args )
{
for ( int a=1; a<45; a++ )
for ( int b=0; b<45; b++ )
for ( int c=0; c<45; c++ )
for ( int d=0; d<45; d++)
{
int e = a + b + c + d;
int f = (a + 2) - (b - 2);
int g = (b - 2) - (c * 2);
int h = (c * 2) - (d / 2);
if ( (e == 45) && (f== 0) && (g == 0) && (h == 0) )
System.out.println( a + ", " + b + ", " + c + ", " + d );
}
}
}
Picture of the output