Swap Two No. with the help of Third Variable
        a=2
        b=3
        #swapping logic
        c=a
        a=b
        b=c
        print "a=",a
        print "b=",b
        o/p: a=3 b=2
 Swap Two No. with the help of Third Variable
        a=2
        b=3
        #swapping logic
        c=a
        a=b
        b=c
        print "a=",a
        print "b=",b
        o/p: a=3 b=2
And swapping without third variable:
ReplyDelete>>> a, b = 2, 3
>>> a, b = b, a
>>> print('a =', a, ', b =', b)
// a = 3 , b = 2
Thanks.....
DeleteAnd the normal logic.......
ReplyDeletehttp://techbackbenchers.blogspot.com/2018/02/swap3.html