Assignemnt #114 Number Puzzle Armstrong
Code
/// Name: JJ Deng
/// Period: 6
/// Program Name: Armstrong Numbers
/// File Name: MoonNumber.java
/// Date Finished: 5/4/2016
public class MoonNumber{
public static void main(String[] args){
System.out.println();
for (int a = 0; a < 10; a++)
{
for ( int b = 0; b < 10; b++)
{
for (int c = 0; c < 10; c++)
{
if ( (a*100 + b*10 + c) == Math.pow(a,3)+Math.pow(b,3)+Math.pow(c,3) )
{
System.out.print(a);
System.out.print(b);
System.out.print(c);
System.out.println();
}
}
}
}
System.out.println();
}
}
Picture of the output