Assignemnt #119 and Number Puzzles IV: A New Hope

Code

/// Name: David Shkolnikov
/// Period: 6
/// Program Name: Num Puz IV
/// File Name: NumPuzIV.java
/// Date Finished: 5/5/2016
public class NumPuzIV
{
    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++ )
                    {
                        int sum = a + b + c + d;
                        int aa = a + 2;
                        int bb = b - 2;
                        int cc = c * 2;
                        int dd = d / 2;
                        
                        if( sum == 45 && aa == bb && bb == cc && cc == dd )
                            System.out.println(a + " " + b + " " + c + " " + d);
                    }
                }
            }
        }
    }
}
  
    

Picture of the output

Assignment 8