🚀 Hurry! Offer Ends In
00 Days
00 Hours
00 Mins
00 Secs
Enroll Now
X

निम्नलिखित का आउटपुट क्या है?

What is the output of the following ?

n=5
while n>0:
       n-=1
       if n ==2:
          continue
       print(n)
A)
B)
C)
D)

Explanation:

Sure! Here's a simpler explanation:

  • Initially, n = 5.
  • The loop runs while n > 0, and in each iteration, n is reduced by 1.
  • When n == 2, the continue skips printing n and moves to the next iteration.

Step-by-step output:

  1. n = 5 → print 4
  2. n = 4 → print 3
  3. n = 3 → skip printing (because n = 2)
  4. n = 1 → print 1
  5. n = 0 → loop ends

So the output is: 4 3 1 0

Answer: (B) 4 3 1 0

Latest Updates