Assignemnt #115 Number Puzzle Hope

Code

    /// Name: JJ Deng
    /// Period: 6
    /// Program Name: NP Hope
    /// File Name: NPHope.java
    /// Date Finished: 5/5/2016
    
  public class NPHope{
    public static void main(String[] args){
        for (int a = 1; a < 45; a++)
        {
            for ( int b = 1; b < 45; b++)
            {
                for ( int c = 1; c < 45; c++)
                {
                    for ( int d = 1; d < 45; d++)
                    {
                        if ( (a+b+c+d) ==45 && (a+2)==(b-2) && (c*2)==(d/2) && (b-2) == (c*2))
                            System.out.print(" "+ a+" "+b+" "+c+" "+d);
                    }
                }
            }
        }
        
        System.out.println();
    }
}

    

Picture of the output

Assignment 115