Assignment #118: Number Puzzle IV

Code

public class NumberPuzzlesIV {

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

Picture of the output