Assignemnt #118 and Number Puzzles III: Armstrong Numbers
Code
/// Name: Kyle Ivy
/// Period: 5
/// Program Name: ArmstrongNumbers.java
/// File Name: ArmstrongNumbers
/// Date Finished: 4/20/2016
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);
}
}
}
}
}
}
prog118.PNG