Assignment #119

Code

        /// Name: Georgi Atanasov
        /// Period: 5
        /// Program Name: Number Puzzles IV: A New Hope
        /// File Name: NumberPuzzle4.java
        /// Date Finished: 2/8/2016
    
    public class NumberPuzzle4
    {
        public static void main(String[] args)
        {
            for (int a = 1; a < 100; a++)
                for (int b = 1; b < 100; b++)
                    for (int c = 1; c < 100; c++)
                        for (int d = 1; d < 100; d++)
                        {
                            int e = a + b + c + d;
                            
                            if ( e == 45 )
                            {
                                if ( a+2 == b-2 && b-2 == c*2 && c*2 == d/2 )
                                    System.out.println( a + " " + b + " " + c + " " + d );
                            }
                        }
        }
    }
    

Picture of the output

Assignment 119