What will be displayed if code corresponding to the following pseudocode is executed?

Set Number = 4
Repeat
Write 2 * Number
Set Number = Number + 2
Until Number = 8

a. 8 b. 4 c. 8 d. 12
12 8 12 16
16 12

Respuesta :

Answer:

8, 12, 16

Explanation:

The user defines an integer "Number" that is 4, then creates a loop, the loop consists of multiplying by 2 the integer that he defined at the beginning, after this operation, increases the integer "Number" by 2, replacing the value of "Number" in each iteration. This cycle is repeated until the value of "Number" is 8.

Therefore, in the first iteration Number = 4

4 * 2 = 8

This is the first result, then the number increases 2 units

Number = 4 + 2 = 6

in the second iteration Number = 6

6 * 2 = 12

This is the second result, then the number increases 2 units

Number = 6 + 2 = 8

in the third iteration Number = 8

8 * 2 = 16

This is the third and final result, because the iteration stops when "Number" reaches the value of 8.

ACCESS MORE