Assignemnt #117
Code
//colin hinton
//5th period
//puz.java
//5/9/2016
import java.util.Scanner;
class puz
{
public static void main (String [] args)
{
Scanner kb = new Scanner(System.in);
int ask;
do
{
System.out.println("1) Find two diget number <= 56 with sum > 10");
System.out.println("2) Find to diget number minus number reversed which equals sum of digets.");
System.out.println("3) Quit");
ask = kb.nextInt();
if (ask == 1)
{
math();
}
else if (ask == 2)
{
meth();
}
}while (ask < 3);
}
public static void math()
{
int counter = 10;
for (int x = 1; x < 6; x++)
{
for (int y = 0; y < 10; y++)
{
if (counter < 57 && (x + y) > 10)
{
System.out.println(counter);
}
counter++;
}
}
}
public static void meth()
{
int drake = 10;
for (int a = 1; a < 10; a++)
{
for (int b = 0; b < 10; b++)
{
int inverse = (b*10)+a;
int sum = a + b;
if (drake - inverse == sum)
{
System.out.println(drake);
}
drake++;
}
}
}
}
Picture of the output