Assignment 118: Armstrong Numbers

Code

  ///Name: Ryan McAteer
  ///Period: 5
  ///Project Name: Armstrong Numbers
  ///File Name: Assignment118.java
  ///Date: 5/3/2016
    
public class Assignment118
{
	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

This Should Work