swap_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

Comments :

  1. And swapping without third variable:

    >>> a, b = 2, 3
    >>> a, b = b, a
    >>> print('a =', a, ', b =', b)
    // a = 3 , b = 2

    ReplyDelete
  2. And the normal logic.......
    http://techbackbenchers.blogspot.com/2018/02/swap3.html

    ReplyDelete

Post a Comment