Assignment #117 More Number Puzzles

Code

    /// Name: John Huh
    /// Period: 6
    /// Program Name: More Number Puzzles
    /// File Name: MorePuzzles.java
    /// Date Finished: 4/25/2016
    
    import java.util.Scanner;
    
    public class MorePuzzles
    {
    	public static void main( String[] args ) throws Exception
    	{
            Scanner keyboard = new Scanner(System.in);
            
            int choice = 0;
            
            System.out.println();
            while ( choice != 3 )
            {
                System.out.println( "1. Find two digit numbers <= 56 with sums greater than 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 = keyboard.nextInt();
                System.out.println();
                
                if ( choice == 1 )
                {
                    for ( int x=1; x<=5; x++ )
                    {
                        for ( int y=0; y<=9; y++ )
                        {
                            int z = x*10 + y;
                            int d = x+y;
                            if ( z <= 56 && d >= 11 )
                            {
                                System.out.println( x + "" + y ); 
                            }
                        }
                    }
                }
                if ( choice == 2 )
                {
                    for ( int x=1; x<=9; x++ )
                    {
                        for ( int y=0; y<=9; y++ )
                        {
                            int a = x*10 + y;
                            int e = y*10 + x;
                            if ( a - e == x + y )
                            {
                                System.out.println( x + "" + y ); 
                            }
                        }
                    }
                }
                System.out.println();
            }
    	}
    }
    

Picture of the output

Assignment 1