Assignment #118 Number Puzzles III: Armstrong Numbers
Code
Name: Iaroslav Titov
Period: 7
Project Name: Armstrong
File Name: Armstrong.java
Date: 1/12/2015
public class Armstrong
{
public static void main( String[] args ) throws Exception
{
System.out.println();
for ( int i = 1; i < 10; i++)
{
for ( int j = 0; j < 10; j++)
{
for ( int k = 0; k < 10; k++)
{
if ( (i*100+j*10+k)== Math.pow(i,3)+ Math.pow(j,3) + Math.pow(k,3))
{
System.out.print(i);
System.out.print(j);
System.out.print(k+" ");
}
}
}
}
System.out.println();
}
}
Picture of the output