Assignemnt #118 and Number Puzzles III: Armstrong Numbers
Code
/// Name: Brian Phillips
/// Period: 5
/// Program name: Number Puzzles III: Armstrong Numbers
/// File Name: Puzzles3.java
/// Date Finished: 5/8/2016
public class Puzzles3
{
public static void main(String[] args)
{
for (int x = 1; x < 10; x++)
for (int y = 1; y < 10; y++)
for (int z = 0; z < 10; z++)
{
int xCube = x*x*x, yCube = y*y*y, zCube = z*z*z;
if ((x*100) + (y*10) + z == xCube + yCube + zCube)
System.out.println(x + "" + y + "" + z);
}
}
}
Picture of the output