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