PROGRAMMING AND CODE


Assignemnt #118

Code

/// Name: Justin Li
/// Period: 7
/// Program Name: Armstrong Numbers
/// File Name: ArmstrongNumbers.java
/// Date Finished: 5/5/2016

public class ArmstrongNumbers
{
	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

Assignment 1