Assignemnt #119

Code

//colin hinton
//5th period
//puz.java
//5/9/2016

class puz
{
    public static void main (String [] args)
    {
        for (int q = 1; q < 500; q++)
        {
            for (int w = 1; w < 500; w++)
            {
                for (int e = 1; e<500; e++)
                {
                    for (int r = 1; r < 500; r++)
                    {
                        
                        int total = (q+w+e+r);
                        int a = q + 2;
                        int b = w - 2;
                        int c = e * 2;
                        int d = r / 2;
                        if (total == 45 && a==b && b==c && c==d)
                        {
                            System.out.println(q + " " + w + " " + e + " " + r);
                        }
                    }
                }
            }
        }
    }
}

    

Picture of the output

Assignment 1