ow to make it the number a row? Can someone fix the code given below:

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

How to make it the number a row? Can someone fix the code given below:

 

import java.util.Scanner;

public class Locker

{
static Scanner Balderas = new Scanner(System.in);

public static void main(String args[])

{

System.out.print("Enter the number of lockers: ");

int number = Balderas.nextInt();

System.out.println("The Number of lockers and students are : " + number);

int numberOfDivisors;

for(int i=1; i <= number; i++)

{

numberOfDivisors = 0;

for(int j=1; j <= number; j++)

if((i % j)==0)

numberOfDivisors++;

if (( numberOfDivisors % 2)!=0 )

System.out.println("The Locker numbers left open at the end of the game are:"+ i);



}

}

}

Enter the number of lockers: 100
The number of lockers and students are: 100
The locker numbers left open at the end of the game are: 1 4 9 16 25 36 49 64 81 100
Transcribed Image Text:Enter the number of lockers: 100 The number of lockers and students are: 100 The locker numbers left open at the end of the game are: 1 4 9 16 25 36 49 64 81 100
Balderas : Scanner
23
24
O main(String[1) : void
numberofDivisors = 0;
25
26
for (int j=1; j <= number; j++)
27
28
29
30
if((i % j)==0)
numberofDivisors++;
31
32
33
34
35
36
37
38
if (( number0fDivisors % 2)!=0 )
System.out.println("The Locker numbers left open at the end of the game are:"+ i);
}
39
40
}
41
42 }
A Problems @ Javadoc E Declaration Console X
<terminated> Locker [Java Application] C:\Program Files\Java\jdk-16.0.2\bin\javaw.exe (7 Sep 2021, 5:02:00 pm – 5:02:06 pm)
Enter the number of lockers: 100
The Number of lockers and students are : 100
The Locker numbers left open at the end of the game/are:1
The Locker numbers left open at the end of the game are:4
The Locker numbers left open at the end of the game are:9
The Locker numbers left open at the end of the game are:16
The Locker numbers left open at the end of the game are:25
The Locker numbers left open at the end of the game are:36
The Locker numbers left open at the end of the game are:49
The Locker numbers left open at the end of the game are:64
The Locker numbers left open at the end of the game are:81
The Locker numbers left open at the end of the game are:100
Transcribed Image Text:Balderas : Scanner 23 24 O main(String[1) : void numberofDivisors = 0; 25 26 for (int j=1; j <= number; j++) 27 28 29 30 if((i % j)==0) numberofDivisors++; 31 32 33 34 35 36 37 38 if (( number0fDivisors % 2)!=0 ) System.out.println("The Locker numbers left open at the end of the game are:"+ i); } 39 40 } 41 42 } A Problems @ Javadoc E Declaration Console X <terminated> Locker [Java Application] C:\Program Files\Java\jdk-16.0.2\bin\javaw.exe (7 Sep 2021, 5:02:00 pm – 5:02:06 pm) Enter the number of lockers: 100 The Number of lockers and students are : 100 The Locker numbers left open at the end of the game/are:1 The Locker numbers left open at the end of the game are:4 The Locker numbers left open at the end of the game are:9 The Locker numbers left open at the end of the game are:16 The Locker numbers left open at the end of the game are:25 The Locker numbers left open at the end of the game are:36 The Locker numbers left open at the end of the game are:49 The Locker numbers left open at the end of the game are:64 The Locker numbers left open at the end of the game are:81 The Locker numbers left open at the end of the game are:100
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY