Assignemnt #118 and ArmstrongNumbers
Code
/// name: Leila Ordukhani
/// period: 6
/// program name: One Hundred and Eight Program
/// file name: ArmstrongNumbers.java
/// date finished: 5/3/16
import java.util.Scanner;
public class ArmstrongNumbers
{
public static void main( String[] args ) throws Exception
{
for (int a = 1; a < 10; a++)
for (int b = 0; b < 10; b++)
for (int c = 0; c < 10; c++)
{
int d = a*100 + b*10 + c;
int e = a*a*a;
int f = b*b*b;
int g = c*c*c;
int h = e + f + g;
if ( d == h )
System.out.println(d);
}
}
}
Picture of the output