Question: package task 1 ; import java.util.Scanner; public class task 1 { public static void main ( String [ ] args ) { / / Declare
package task;
import java.util.Scanner;
public class task
public static void mainString args
Declare variables for first input, second input, bigger input, and smaller input, and loop character.
int first, second;
int bigger, smaller;
char loopCondition ;
Scanner input new ScannerSystemin;
Start loop based on loop condition.
while loopCondition ;
Prompt the user to enter two numbers.
System.out.printPlease enter two numbers: ;
Read in those two numbers.
first input.nextInt;
second input.nextInt;
Check which number is larger.
if Mathabsfirst Math.abssecond;
bigger first;
smaller second;
else
smaller first;
bigger second;
Prevent dividing by zero errors.
if bigger smaller ;
System.out.printlnDo not divide by zero!";
Check if two numbers are divisible
else if bigger smaller
If so print the divisor.
System.out.printfd goes into d d times.
smaller, bigger,biggersmaller;
else
If not, say not divisible
System.out.printlnThese numbers are not divisible.";
Prompt the user to repeat loop.
System.out.printlnTo continue type ;
System.out.printlnTo exit, type any other character.";
Take loop condition input and check if its
loopCondition input.nextcharAt;
Loop again or break out depending on loop condition.
Scanner.close;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
