Assignment 119, Number Puzzle IV: A New Hope
Code
///Name: Stella Koliavas
///Period: 5
///Program Name: Number Puzzle 4
///File Name: 4.java
///Date Finshed: 5/25/16
public class NumberPuzzle4
{
public static void main( String[] args )
{
for ( int x=1; x < 45; x++ )
{
for ( int y=1; y < 45; y++ )
{
for ( int z=1; z < 45; z++ )
{
for ( int q=1; q <45; q++ )
{
int a = x + y + z + q;
int b = x + 2;
int c = y - 2;
int d = z * 2;
int e = q/2;
if ( b == c && c == d && d == e && a == 45)
System.out.println( x + " " + y + " " +z+ " " + q );
}
}
}
}
}
}
Picture of the output