Assignemnt #117 moquiz.java
Code
/// Name: Boris Kazantsev
/// Period: 6
/// Program Name: moquiz
/// File Name: moquiz.java
/// Date Finished: 5/18 /2016
import java.util.Scanner;
public class moquiz{
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
int choice = 0;
do{
System.out.println();
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");
System.out.println();
System.out.print("> ");
choice = keyboard.nextInt();
if ( choice == 1 ) one();
if ( choice == 2 ) two();
}
while (choice != 3);
System.out.println("BYE");
}
public static void one()
{
for ( int i = 1; i < 10; i++)
{
for ( int j = 0; j < 10; j++)
{
if ((i*10+j)<=56 && (i+j>10) )
{
System.out.print(i);
System.out.print(j + " ");
}
}
}
System.out.println();
}
public static void two()
{
for ( int i = 1; i < 10; i++)
{
for ( int j = 0; j < 10; j++)
{
if ((i*10+j)-(j*10+i)==(i+j) )
{
System.out.print(i);
System.out.print(j+" ");
}
}
}
System.out.println();
}
}
Picture of the output