Assignment 117

import java.util.Scanner;

public class NumberPuzzle
{
    public static void main( String[] args )
    {
        Scanner keyboard = new Scanner(System.in);
        int n = 0;
        
        while (n != 3)
        {
            System.out.print("1) 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>");
            n = keyboard.nextInt();
            if (n == 1)
                Function1();
            if (n == 2)
                Function2();
        }
    }
    
    public static void Function1()
    {
        System.out.println();
        
        for (int x = 1; x <= 5; x++)
        {
            for (int y = 0; y <= 9; y++)
            {
                if  (x * 10 + y <= 56 && x + y > 10)   
                    System.out.println(x+""+y);
            }
        }
        
        System.out.println();
    }
    
    public static void Function2()
    {
        System.out.println();
        
        for (int x = 1; x <= 9; x++)
        {
            for (int y = 0; y <= 9; y++)
            {
                if  ((x * 10 + y) - (y * 10 + x) == x + y)
                    System.out.println(x+""+y);
            }
        }
        
        System.out.println();
    }
}