119 Number Puzzles IV: A New Hope

Code

    //Tyler Hart
    //period 5
    //NewHope.java
    //Number Puzzles IV: A New Hope
    //11/10/2015
    

public class NewHope
{
	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 )
                                                {
                                                        int e = a + 2, f = b - 2, g = c * 2, h = d/ 2;
                                                        
                                                        if ( e == f )
                                                        {
                                                            if ( f == g )
                                                            {
                                                                if (g == h )
                                                                    System.out.println( "A is: " + a + " B is: " + b + " C is: " + c + " D is: " + d );
                                                            }
                                                        }
                                                        
                                                }
                                        }
                                }
                        }
                }
        }
	
}



    

Picture of the output