Assignemnt #118 and Number Puzzles III: Armstrong Number

Code

/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Num Puz III
/// File Name: NumPuzIII.java
/// Date Finished: 5/3/2016

public class NumPuzIII
{
    public static void main( String[] args )
    {
        for( int a = 1; a <= 9; a++ )
        {
            for( int b = 0; b <= 9; b++ )
            {
                for( int c = 0; c <= 9; c++ )
                {
                    int a3 = a * a * a;
                    int b3 = b * b * b;
                    int c3 = c * c * c;
                    
                    int n = a3 + b3 + c3;
                    int OGn = (a * 100) + (b * 10) + c;
                    
                    if (n == OGn)
                        System.out.print(n + " ");
                }
            }
        }
        System.out.println();
    }
}
    

Picture of the output

Assignment 8