105k views
3 votes
What is the output of the following program? numa = 2 numb = 3 while numa > 0: numa = numa - 1 while numb > 0: numb = numb - 1 print (numa, numb).

1 Answer

6 votes

Answer:

0 0
python

Step-by-step explanation:

numa = 2
numb = 3
while numa > 0:
numa = numa - 1
while numb > 0:
numb = numb - 1
print(numa, numb)

so lets go through this step by step. we have a which is 2. we have b which is 3. so while numa > 0. which is true since numa is 2, which is more than 0. while numa is more than 0, subtract it by 1. so then num a eventually becomes 0.
now numb is the same. its going to be subtracted until it becomes 0.
so the print is...
0 0

User Rupam Datta
by
3.7k points