Assignemnt #117: More Number Puzzles
Code
/// Name: Kelsey Lieberman
/// Period 5
/// Program Name: MoreNumberPuzzles
/// File Name: MoreNumberPuzzles.java
/// Date Finished: 2/16/2016
import java.util.Scanner;
public class MoreNumberPuzzles
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int choice;
do
{
System.out.print("\n1) Find two digit numbers <= 56 with sums of digits > 10\n2) Find two digit number minus number reversed which equals sum of digits\n3) Quit\n\n>>");
choice = keyboard.nextInt();
if (choice == 1)
{
System.out.println();
func1();
}
else if (choice == 2)
{
System.out.println();
func2();
}
else
System.out.println("\nProgram End.\n");
}while (choice == 1 || choice == 2);
}
public static void func1()
{
for (int x = 1; x < 6; x++)
for (int y = 0; y < 10; y++)
{
if ((x + y > 10) && (x*10 + y < 57))
System.out.println(x + "" + y);
}
}
public static void func2()
{
for (int x = 1; x < 10; x++)
for (int y = 0; y < 10; y++)
{
if (((x * 10) + y) - ((y*10) + x) == x + y)
System.out.println(x + "" + y);
}
}
}
Picture of the output