Posts

Showing posts with the label swap two number

Swap the two Numbers (interchange the value) without using third variable.

Image
5)      Write a program to input two number and Swap the Numbers (interchange the value) without using third variable. a=int(input("enter the first number : ")) b=int(input("enter the second number : ")) print("before swaping no. :") print("a= ",a) print("b= ",b) a=a+b b=a-b a=a-b print("after swaping no. :") print("a= ",a) print("b= ",b) swap-two-numbers-without-using-third-variable

swap the two numbers program in python

Image
4)     Write a program to input two number and Swap the Numbers (interchange the value) using third variable. a=int(input("enter the first number : ")) b=int(input("enter the second number : ")) print("before swaping no. :") print("a= ",a) print("b= ",b) c=a a=b b=c print("after swaping no. :") print("a= ",a) print("b= ",b) swap-two-numbers-program-in-python