NewHope

Code

import java.util.Scanner;

public class NewHope
{
    public static void main( String[] args ) throws Exception
    {
        int n1, n2, n3, n4;
        
        for ( n1=0; n1<100; n1++ )
        {
            for ( n2=0; n2<100; n2++ )
            {
                for ( n3=0; n3<100; n3++ )
                {
                    for ( n4=0; n4<100; n4++ )
                    {
                        if ( n1+n2+n3+n4==45 )
                        {
                            if (n1+2==n2-2)
                            {
                                if ( n2-2==n3*2 )
                                {
                                    if ( n3*2==n4/2 )
                                    {
                                        System.out.println( n1 + " " + n2 + " " + n3 + " " + n4 );
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}

NewHope

Assignment 119