466,504 views
1 vote
1 vote
What is output by the following code? Select all that apply.

c = 2




while (c < 12):

print (c)
c = c + 3

User Eric Baldwin
by
2.8k points

1 Answer

7 votes
7 votes

Explanation:

that is not mathematics, and I am not sure, if you listed everything, but the result to such a loop is

25811

because it first prints the Imuran content of c (2).

then it increases the content of c by 3. c is now 5

then it checks that 5 is still smaller than 12 (yes it is), and it prints 5.

then it prints 8. then 11. and then c becomes 14 and is therefore larger than 12. and the loop ends.

I don't know what your particular print command does, but I assume it is just a basic "bring the parameter to output". in that case it will write all numbers right after the previous number.

hence : 25811

User Rambalac
by
3.3k points