Assignment #119
Code
/*
jack newsom
period 5
program NewHope
filename NewHope.java
date completed 11/16/2015
*/
public class NewHope
{
public static void main( String[] args )
{
for ( int num1 = 1; num1 <= 42; num1 = num1 + 1 )
{
for ( int num2 = 1; num2 <= 42; num2 = num2 + 1 )
{
for ( int num3 = 1; num3 <= 42; num3 = num3 + 1 )
{
for ( int num4 = 1; num4 <= 42; num4 = num4 + 1 )
{
int sum = num1 + num2 + num3 + num4;
int test1 = num1 + 2;
int test2 = num2 - 2;
int test3 = num3 * 2;
int test4 = num4 / 2;
boolean equalTest = false;
if ( test1 == test2 && test2 == test3 && test3 == test4 )
{
equalTest = true;
}
if ( sum == 45 && equalTest == true )
{
System.out.println( "( " + num1 + ", " + num2 + ", " + num3 + ", " + num4 + " )");
}
}
}
}
}
}
}
Picture of the output