105k views
8 votes
What is output? c = 1 sum = 0 while (c < 10): c = c + 3 sum = sum + c print (sum)

User BogdanC
by
4.5k points

1 Answer

9 votes

Answer:

21

Step-by-step explanation:

The values of c that make it into the loop are 1, 4, 7.

The values that are added to sum are 3 higher, i.e., 4,7 and 10.

The sum of those is 21.

p.s. why did you not run the program yourself?

User Constantin
by
4.3k points