Assignemnt #118 and Number Puzzles The Revenge
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Number Puzzles The Revenge
///File Name: NumberPuzzlesTheRevenge
///Date Finished: 3/24/16
public class NumberPuzzlesTheRevenge
{
public static void main( String[] args )
{
System.out.println(" ");
for( int x = 1; x < 10; x++ )
{
for( int y = 0; y < 10; y++ )
{
for( int z = 0; z < 10; z++ )
{
double cubex = Math.pow(x, 3);
double cubey = Math.pow(y, 3);
double cubez = Math.pow(z, 3);
double sum = cubex + cubey + cubez;
int num = (x*100)+(y*10)+z;
if(sum==num)
{
System.out.println(num);
}
}
}
}
System.out.println(" ");
}
}
Picture of the output