49.5k views
4 votes
What is output by the following code? Select all that apply. Please explain if can!

c = 2




while (c < 12):

print (c)
c = c + 3

1 Answer

4 votes

Step-by-step explanation:

The code will print:

2

5

8

11

Explanation: The code defines a variable c and initializes it to 2. It then enters a while loop that continues as long as c is less than 12. Within the loop, the value of c is printed, then incremented by 3 with each iteration. The loop continues until c is equal to or greater than 12. The values printed by the code are 2, 5, 8, and 11.

User Anders Gustafsson
by
8.5k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.