Code
/// Name: Afaf Nabeeha
/// Period: 7
/// Program Name: Number Puzzles III: Armstrong Numbers
/// File Name: Armstrong.java
/// Date Finished: 3/8/2016 public class Armstrong
import java.util.Scanner;
public class Armstrong
{
public static void main(String[] args)
{
Scanner kb = new Scanner(System.in);
int choice;
do
{
System.out.println("1.) Find two digit numbers <= 56 with sums of digits > 10");
System.out.println("2.) Find two digit number minus number reversed which equals sum of digits");
System.out.println("3.) Quit");
System.out.println("");
System.out.print("> ");
choice = kb.nextInt();
if (choice == 1)
f1();
else if (choice == 2)
f2();
else
System.out.print("");
} while (choice != 3);
}
public static void f1()
{
for (int a = 1; a <= 5; a++)
{
for (int b = 0; b < 10; b++)
{
int n1 = (10 * a) + b;
int s = a + b;
if (s > 10 && n1 <= 56)
{
System.out.println(a + "" + b);
}
}
}
}
public static void f2()
{
for (int a = 1; a < 10; a++)
{
for (int b = 0; b < 10; b++)
{
int n1 = (a * 10) + b;
int n2 = (b * 10) + a;
if (n1 - n2 == a + b)
{
System.out.println(a + "" + b);
}
}
}
}
}
Picture of the output