subject

Convert each of the following for loops into an equivalent while loop. (You might need to rename some variables for the code to compile, since all four parts a-d are in the same scope.) // a.

System. out. println("a.");
int max = 5;
for (int n = 1; n <= max; n++) {

System. out. println(n);

}

System. out. println();

// b.

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

int total = 25;

for (int number = 1; number <= (total / 2); number++) {

total = total - number;

System. out. println(total + " " + number);

}

System. out. println();

// c.

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

for (int i = 1; i <= 2; i++) {

for (int j = 1; j <= 3; j++) {

for (int k = 1; k <= 4; k++) {

System. out. print("*");

}

System. out. print("!");

}

System. out. println();

}

System. out. println();

// d.

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

int number = 4;

for (int count = 1; count <= number; count++) {

System. out. println(number);

number = number / 2;

}

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 20:00
Need asap assignment directions: think of an organization (business, religious institution, volunteer organization, sports team) with which you have been involved. imagine outfitting it with an it infrastructure. prepare a plan for what you would do to support outfitting it. draw a map of a network connecting all the individuals, give them pcs and printers, and lay out the design as best you can. the purpose is to begin working with these concepts, not to build a perfect network.
Answers: 2
question
Computers and Technology, 22.06.2019 23:30
Select all that apply. which of the following are proofreading options included in microsoft word? spell check find replace grammar check formatting check
Answers: 1
question
Computers and Technology, 23.06.2019 02:30
Rafael needs to add a title row to a table that he has inserted in word. what should he do? use the alignment options. use the merge and center option for all the cells in the top row. use the merge and center option on the first two cells in the top row. none of the above
Answers: 3
question
Computers and Technology, 23.06.2019 15:00
Barbara is interested in pursuing a career in the science and math pathway. which qualifications will her reach that goal? a.an advanced knowledge of physics and math b.an advanced knowledge of engineering and math c. an advanced knowledge of physics and robotics an d. advanced knowledge of machinery and math
Answers: 2
You know the right answer?
Convert each of the following for loops into an equivalent while loop. (You might need to rename som...
Questions
question
Mathematics, 22.04.2021 14:00
question
Mathematics, 22.04.2021 14:00
question
Mathematics, 22.04.2021 14:00
question
Spanish, 22.04.2021 14:00