निम्नलिखित का आउटपुट क्या है?
What is the output of the following ?
i = 2
while True:
if i%3 == 0:
break
print(i,end=" " )
i += 2
A
2 4 6 8 10 ..
B
2 4
C
2 3
D
error
Explanation
The given code prints values of i starting from 2 and increases i by 2 on each iteration. It prints i until i is divisible by 3. Here's the breakdown:
i = 2:2 % 3 != 0, prints 2, thenibecomes 4.i = 4:4 % 3 != 0, prints 4, thenibecomes 6.i = 6:6 % 3 == 0, the loop breaks.
Output: 2 4
So, the answer is (B) 2 4.
Correct Answer: B) 2 4