निम्नलिखित का आउटपुट क्या है?
What is the output of the following ?
i = 2
while True:
if i%3 == 0:
break
print(i,end=" " )
i += 2
A)
B)
C)
D)
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, theni
becomes 4.i = 4
:4 % 3 != 0
, prints 4, theni
becomes 6.i = 6
:6 % 3 == 0
, the loop breaks.
Output: 2 4
So, the answer is (B) 2 4.