Question: Complete the code below to print 8 per line of the first 5 0 lines by putting the lines of code in order. public class

Complete the code below to print 8 per line of the first 50 lines by putting the lines of code in order.
public class PrimeNumber {
public static void main(String[] args){
final int NUMBER_OF_PRIMES =50;
final int NUMBER_OF_PRIMES_PER_LINE =8;
int count =0;
int number =2;
System.out.println("The first 50 prime numbers are
");
while (count < NUMBER_OF_PRIMES){
boolean isPrime = true;
for (int divisor =2; divisor <= number /2; divisor++){
if (number % divisor ==0){
isPrime = false;
break;
}
}
...
1
Answer 1
if (isPrime){
2
Answer 2
Choose...
3
Answer 3
Choose...
4
Answer 4
Choose...
5
Answer 5
Choose...
6
Answer 6
Choose...
7
Answer 7
number++; }}}
answers are else , Syste.out.print(number +"");}, System.out.println(number);}, count++; , if (count % NUMBER_OF_PRIMES_PER_LINE==0)}

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 Programming Questions!