118 Number Puzzles III: Armstrong Numbers
Code
//Tyler Hart
//period 5
//Arm.java
//Number Puzzles III: Armstrong Numbers
//11/10/2015
import java.util.Scanner;
public class Arm
{
public static void main( String[] args ) throws Exception
{
for ( int hund=0; hund<10; hund++ )
for ( int tens=0; tens<10; tens++ )
for ( int ones=0; ones<10; ones++ )
{
int h = hund*hund*hund,t=tens*tens*tens,o=ones*ones*ones;
if (h+t+o == hund*100+tens*10+ones)
{
System.out.print( " " + hund + "" + tens + "" + ones + "\r" );
Thread.sleep(10);
}
}
}
}
Picture of the output