Write a program to read three numbers in three variables and swap first two variables with the sum of first and second,second and third numbers respectively
Answers
Answered by
80
Answer:
#program that accepts three number and swaps those number first and second,second and third
a=int(input("Enter the first number :"))
b=int(input("Enter the second number :"))
c=int(input("Enter the third number :"))
print("numbers before swaping of first and second number :",a,b)
a=a+b
b=a-b
a=a-b
print("numbers after swaping of first and second number :",a,b)
print("numbers before swaping of second and third number :",b,c)
b=b+c
c=b-c
b=b-c
print("numbers after swaping of second and third number :",b,c)
Answered by
50
a=int(input("enter the first value "))
b=int(input("enter the second value"))
c=int(input("enter the third value"))
a=a+b
b=a-b
a=a-b
print(a,b)
b=c+b
c=b-c
b=b-c
print(b,c)
Similar questions