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, 23.06.2019 13:50
Explain how email technologies enable the exchange of messages between users. find out the typical parts of an email address and explain each part.
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
What can a word user do with the customize ribbon dialog box? check all that apply. minimize the ribbon add a new tab to the ribbon remove a group from a tab add a group to a tab choose which styles appear choose which fonts appear choose tools to appear in a group
Answers: 1
question
Computers and Technology, 24.06.2019 13:30
In the rgb model, which color is formed by combining the constituent colors? a) black b) brown c) yellow d) white e) blue
Answers: 1
question
Computers and Technology, 24.06.2019 16:00
Which type of cloud computing offers easily accessible software and applications on the machines
Answers: 1
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
English, 06.03.2020 22:42
Questions on the website: 13722363