निम्नलिखित का आउटपुट क्या है?
What is the output of the following ?
m = 0
while m < 5:
print(m)
m += 1
if m == 3:
break
else:
print(0) A
0 1 2 0
B
0 1 2
C
0 0 1 0 2
D
error
Explanation
Here’s how the code works:
- First iteration: Prints
0, then0again (sincem != 3). - Second iteration: Prints
1, then0again. - Third iteration: Prints
2, then the loop stops becausem == 3.
Output: 0 0 1 0 2
Answer: (C) 0 0 1 0 2
Correct Answer: B) 0 1 2