Answer:
Step-by-step explanation:
The following code is written in Java and creates a loop that cycles the same prompt until the user states no. While the loop runs it asks the user for an integer value and returns the binary code of that value
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
boolean continueLoop = true;
while (continueLoop) {
System.out.println("Would you like to continue? Y/N");
String answer = in.nextLine().toLowerCase();
if (answer.equals("y")) {
System.out.println("Enter int value: ");
int number = in.nextInt();
System.out.println("Integer: "+number);
System.out.println("Binary = " + Integer.toBinaryString(number));
} else if (answer.equals("n")){
System.out.println("breaking");
break;
}
}
}