Advertisements
Advertisements
Question
Find the output of the following program segment:
a = 110
while a > 100:
print(a)
a -= 2Short/Brief Note
Advertisements
Solution
The value of ‘a’ is decreased by 2 on each iteration of the loop and when it reaches 100, the condition a >100 becomes false and the loop terminates.
OUTPUT:
110
108
106
104
102
shaalaa.com
Is there an error in this question or solution?
