Q19. Find the output for the following code fragment:
x=10
y=0
while xy
print(x,y)
x=x-1
y=y+1
Answers
Answered by
6
Answer:
This code won't print anything.
Explanation:
I am assuming the code to be
x = 10
y = 0
while(x*y)
{
print(x,y)
}
x = x-1
y = y-1
So here, as initially x=10,y=0, the product x*y turns out to be 0. Hence the while loop will not execute at all and hence nothing will be printed. After while loop,
x = 10-1 = 9
and y = 0+1 = 1
Similar questions