Python Program to Swap Two Numbers Without Using Third(Temporary) Variable



In this program we will swap two numbers without using a third varibale.



  1. #Swap two numbers without using third variable
  2. a=int(input("Enter first number: "))
  3. b=int(input("Enter second number: "))
  4. a = a + b;
  5. b = a - b;
  6. a = a - b;
  7. print("Swapping of numbers are: ", a, "and", b)

Output
Output!




codesadda.com

Codesadda.com is your home of programming solutions, tutorials, video tutorials and much more. Sign Up for our weekly newsletter to get update about new content.

Like us on Facebook | Connect with us on LinkedIn | Subscribe our Channel on Youtube