Assignment #118 and Number Puzzles III: Armstrong Numbers
Code
/// Name: Brendan Baird
/// Period: 6
/// Program Name: Number Puzzles III: Armstrong Numbers
/// File Name: NumberPuzzle3.java
/// Date Finished: 2/8/2016
public class NumberPuzzle3
{
public static void main(String[] args)
{
for (int a = 1; a < 10; a++)
for (int b = 0; b < 10; b++)
for (int c = 0; c < 10; c++)
{
int d = a*100 + b*10 + c;
int e = a*a*a;
int f = b*b*b;
int g = c*c*c;
int h = e + f + g;
if ( d == h )
System.out.println(d);
}
}
}
Picture of the output