The following code contains a logic error: Scanner console = new Scanner(System.in); System.out.print("Type a number: "); int number = console.nextInt(); if (number % 2 == 0) { if (number % 3 == 0) {...


The following code contains a logic error:



Scanner console = new Scanner(System.in);

System.out.print("Type a number: ");

int number = console.nextInt();

if (number % 2 == 0) {

if (number % 3 == 0) {

System.out.println("Divisible by 6.");

} else {

System.out.println("Odd.");

}

}

Examine the code and describe a case in which the code would print

something that is untrue about the number that was entered. Explain

why. Then correct the logic error in the code.



Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here