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 11:30
What do character formats do for your document's message? a.set the tone b.provide organization c.provide clarity d.set how texts align with documents
Answers: 2
question
Computers and Technology, 23.06.2019 08:30
All of these are true about using adhesive except: a. dissimilar materials can be joined. b. mixing tips are product and material specific. c. a specific application gun may be required. d. two-part adhesives are dispensed using two mixing tips
Answers: 3
question
Computers and Technology, 24.06.2019 02:20
Peter is thinking of a number which isless than 50. the number has 9 factors.when he adds 4 to the number, itbecomes a multiple of 5. what is thenumber he is thinking of ?
Answers: 1
question
Computers and Technology, 24.06.2019 17:50
You will subnet the network address 172.31.103.0/24. the network has the following requirements: · room-114 lan will require 27 host ip addresses · room-279 lan will require 25 host ip addresses · room-312 lan will require 14 host ip addresses · room-407 lan will require 8 host ip addresses how many subnets are needed in the network topology?
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, 26.09.2019 14:30
question
Mathematics, 26.09.2019 14:30
question
History, 26.09.2019 14:30
Questions on the website: 13722363