Assignemnt #123

Code

/// Name: Connor Siri
/// Period: 7
/// Program Name: Hope
/// File Name: Hope.java
/// Date Finished: 3/3/2016
import java.util.Scanner;
public class Hope
{
	public static void main( String[] args ) throws Exception
	{
        Scanner kb = new Scanner (System.in);
        
        for (int a = 0; a < 46; a++)
        {
        for (int b = 0; b < 46; b++)
        {
        for (int c = 0; c < 46; c++)
        {
        for (int d = 0; d < 46; d++)
        {
            int sum = a + b + c + d;
            int x = a + 2;
            int y = b - 2;
            int z = c * 2;
            int w = d / 2;
        
            if (x == y && y == z && z == w && sum == 45)
            {
                System.out.println(a+", "+b+", "+c+", " +d);
            }
        }
        }
        }
    }
}
}
		
 

Picture of the output

Assignment12.html