Assignemnt #119 Number Puzzles 4
Code
///Name: Morgan Kaplan
///Period: 5
///Project Name: Number Puzzles 4
///File Name: NPF.java
public class NPF
{
public static void main( String[] args )
{
for ( int a = 1; a < 45; a++ )
{
for ( int b = 1; b < 45; b++ )
{
for (int c = 1; c < 45; c++ )
{
for ( int d = 1; d < 45; d++ )
{
if ( (a + b + c + d) == 45 )
{
int e = a + 2, f = b - 2, g = c * 2, h = d/ 2;
if ( e == f )
{
if ( f == g )
{
if (g == h )
System.out.println( "A is: " + a + " B is: " + b + " C is: " + c + " D is: " + d );
}
}
}
}
}
}
}
}
}
Picture of Output