prestonhayes6218 prestonhayes6218
  • 12-11-2019
  • Computers and Technology
contestada

int i = 1, mult3 = 3;

while (mult3 < 20)

System.out.print(mult3 + " ");

i++;

mult3 *= i;

Respuesta :

Branta Branta
  • 14-11-2019

Answer:

3 6 18

Explanation:

Code segment:

int i = 1, mult3 = 3;

while (mult3 < 20) {

// We assume the body of the while loop to be enclosed in {}

// Otherwise the code will print 3 in an infinite loop

System.out.print(mult3 + " ");

i++;

mult3 *= i;

}

Let us iterate through the while loop:

i=1 , mult3 = 3

i=2 , mult3 = 6

i=3 , mult3 = 18

i=4, mult3 = 72 ( The while loop terminates)

So the code will print out the following result:

3 6 18

Answer Link

Otras preguntas

explain how you would take a survey to find your classmates favorite shirt color
what types of german citizens were victims of the nazi party
payment types that require you to pay upfront
find the area of the figure
Why do stretching exercises increase flexibility more than cardio exercises? (a) Cardio exercises do not require a full range of motion. (b) Cardio exercises im
How are ions Formed?
what multiplies to 16 and adds to negative 12
How did the Bedouin learn to live in the desert of the Arabian peninsula?
Which trait is not a desirable quality in a primary care physician? interactive courteous presumptuous empathetic
What is the effect of the underlined section in developing the tone of this excerpt from "In a Queen's Domain" by Sarah Morgan Bryan Piatt?