157k views
3 votes
Question 2 0 / 1 pts What is output by the following code? Select all that apply. c = 2 while (c < 12): print (c) c = c + 3

1 Answer

4 votes

Answer:

c = 2

while (c < 12):

print (c)

c = c + 3

The output of the following code will be:

2

5

8

11

Step-by-step explanation:

The code uses a while loop to print the value of the c variable, starting from 2, and then incrementing c by 3 on each iteration. The loop continues until c is greater than or equal to 12, at which point the loop stops and the program ends.

Therefore, the output will be the values of c on each iteration of the loop: 2, 5, 8, and 11. These values will be printed on separate lines.

User Inactivist
by
4.1k points