Question: What is the output after the following loop terminates? int number = 2 5 ; int i ; boolean isPrime = true; for ( i

What is the output after the following loop terminates?
int number =25;
int i;
boolean isPrime = true;
for (i=2;i number && isPrime; i++){
if (number % i =0){
isPrime = false;
}
}
System.out.println("i is "+i +" isPrime is "+ isPrime);
i is 5 isPrime is false
i is 6 isPrime is true
i is 6 isPrime is false
i is 5 isPrime is true
 What is the output after the following loop terminates? int number

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!