Assignment #117: Number Puzzle II

Code

import java.util.Scanner;

public class NumberPuzzleII {

    public static void main(String [] args) {
    
        Scanner kb = new Scanner(System.in);
        
        int choice;
    
        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");
        choice = kb.nextInt();
        
        do {
        
            if (choice == 1) {
            
                digitSum();
                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");
                choice = kb.nextInt();
                
            }
            
            if (choice == 2) {
            
                digitReverse();
                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");
                choice = kb.nextInt();
                
            }
            
        } while (choice <= 2);
        
        if (choice == 3) {
        
            System.out.println("Goodbye!");
            
        }
        
    }
    
    public static void digitSum() {
    
        for (int x = 1; x <= 5; x++) {
        
            for (int n = 0; n <= 9; n++) {
            
                if (x + n == 10) {
                
                    System.out.println ((10 * x) + n);
                    
                }
                
            }
            
        }
        
    }
    
    public static void digitReverse() {
    
        for (int y = 1; y <= 9; y++) {
        
            for (int p = 0; p <= 9; p++) {
            
                if (((10 * y) + p) - ((10 * p) + y) == (p + y)) {
                
                    System.out.println((10 * y) + p);
                    
                }
                
            }
            
        }
        
    }
    
}
    

Picture of the output