Assignment # 119 and Puzzles 4

Code

    /// Name: Tommy Oyuntseren
    /// Period: 7
    /// Program Name: Puzzles4
    /// File Name: Puzzles4.java
    /// Date: 5/27/16

    public class Puzzles4
    {
    	public static void main(String[] args)
    	{
            for (int a=1; a< 45; a++)
                for ( int b=0; b< 45; b++)
                    for ( int c=0; c< 45; c++)
                        for ( int d=0; d< 45; d++)
                        {
                            int e = a + b + c + d;
                            int f = (a + 2) - (b - 2);
                            int g = (b - 2) - (c * 2);
                            int h = (c * 2) - (d / 2);
                            if ((e == 45) && (f== 0) && (g == 0) && (h == 0))
                                System.out.println( a + ", " + b + ", " + c + ", " + d );
                        }
        }
    }
    
	
  
  

  

Picture of the output

Assignment 119