Assignment #118 and Number Puzzles III: Armstrong Numbers
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: NP3
/// File Name: NP3.java
/// Date Finished: 05/5/2016/
public class NP3
{
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 number = (100 * a) + (10 * b) + c;
int total = (a * a * a) + (b * b * b) + (c * c * c);
if (number == total)
{
System.out.println(a + "" + b + "" + c);
}
}
}
}
}
}
Picture of the output