Assignemnt #117

Code

/// Name: Ryan Volko
/// Period: 7
/// Program Name: More
/// File Name: More.java
/// Date Finished: 5/4/2016
import java.util.Scanner;
public class More
{
	public static void main( String[] args ) throws Exception
	{
        Scanner kb = new Scanner (System.in);
        int j;
        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 reverse which equals sum of digits");
        System.out.println("3) Quit");
        System.out.println("");
        System.out.println("");
        System.out.print(">");
        j = kb.nextInt();
        
    
            if (j==1)
            f1();
        else if (j == 2 )
            f2();
            else 
            System.out.println("");
    }while (j != 3);
                
    }
    public static void f1()
    {
        for (int x = 1; x <=5; x++)
        {
            for (int y = 0; y < 10; y++)
            {
                int n = ( 10 * x) + y;
                int m = x + y;
                
                if ( m > 10 && n <= 56)
                {
                    System.out.println(x + "" + y);
                }
            }
        }
    }
    public static void f2()
    {
        for ( int x = 1; x < 10; x++)
        {
            for ( int y = 0; y < 10; y++)
            {
                int n = ( x * 10) + y;
                int m = ( y * 10) + x;
                
                if ( n - m == x + y  )
                {
                    System.out.println(x+""+y);
                }
            }
        }
    }
    }
    

Picture of the output

Assignment 117