144k views
21 votes
Determine what is printed by the following code.

Determine what is printed by the following code.-example-1
User Marry
by
3.9k points

1 Answer

8 votes

Answer:

18

Step-by-step explanation:

a will get the values 3,6,9,12,15 and 18.

sum will get the values 0,3,9,18,30 and 45. When it gets to 45, the loop will not be executed anymore.

At that point, a is 18.

User Cagney
by
4.8k points