Assignement:New Hope Number Puzzle
Code
/// Name: Sean Harrison
/// Period: 7
/// Program name: NewHopeNumberPuzzle
/// File Name: NewHopeNumberPuzzle.java
/// Date Finished: 5/5/2016
public class NewHopePuzzle
{
public static void main( String[] args ) throws Exception
{
System.out.println();
for ( int n = 1; n < 43; n++)
{
for ( int j = 1; j < 43; j++)
{
for ( int k = 1; k < 43; k++)
{
for ( int l = 1; l < 43; l++)
{
if ( (n+j+k+l)==45 && n+2==j-2 && k*2==l/2 && j-2==k*2 )
System.out.print(" "+n+" "+j+" "+k+" "+l+"\n");
}
}
}
}
System.out.println("Nice Work");
}
}
Picture of the output