Home / Expert Answers / Computer Science / nbsp-nbsp-suppose-the-input-for-number-is-9-what-is-the-output-from-running-the-following-pa729

# (Solved):     Suppose the input for number is 9. What is the output from running the following ...

Suppose the input for number is 9. What is the output from running the following program? import java.util.Scanner; public class Test [ public static void main(String[] args) Scanner input = new Scanner(System.in); System.out.print("Enter an integer: "); int number $$=$$ input.nextlnt(); int $$\mathrm{i}$$; boolean isPrime $$=$$ true; for $$(i=2 ; i<$$ number $$\& \&$$ isPrime; $$i++)\}$$ if (number \% i == 0) \{ isPrime $$=$$ false; ] System.out.println("i is " $$+\mathrm{i})$$; if (isPrime) System.out.printin(number + "is prime"); else system.out.print("Enter an integer: "); int number = input.nextlnt(); int $$\mathrm{i}$$; boolean isPrime $$=$$ true; for $$(i=2 ; i<$$ number \& \& isPrime; $$i++)\{$$ if (number \% $$i==0$$ ) \{ isPrime $$=$$ false; \} \} System.out.println("i is " $$+\mathrm{i})$$; if (isPrime) System.out.println(number + "is prime"); else System.out.println(number + "is not prime");

We have an Answer from Expert