Assignment #118

Code

    
    ///Name: Cody Swain
    ///Period: 6
    ///Project Name: ArmstrongNumbers
    ///File Name: ArmstrongNumbers.java
    ///Date: 5/6/16
    
    
    
    public class ArmstrongNumbers
    {
        public static void main( String[] args )
        {
            for (int a=1; a<10; a++){
                for (int b=0; b<10; b++){
                    for (int c=0; c<10; c++){
                        int a1 = (a*a*a);
                        int b1 = (b*b*b);
                        int c1 = (c*c*c);
                        int sum = ((100*a) + (10*b) + c);
                        if ( sum == (a1 + b1 + c1) ){
                            System.out.println(sum);
                        }
                    }
                }
            }
        }
    }
                
    



    

Picture of the output

Assignment 118