50.5k views
3 votes
15. Write a program in python to read three numbers in three variables and swap first two variables with the sums of

first and second, second and third numbers respectively.​

User Theozh
by
5.6k points

1 Answer

6 votes

Answer:

a = int(input("Enter first number: "))

b = int(input("Enter second number: "))

c = int(input("Enter third number: "))

a,b = a+b,b+c

print(a,b,c)

Step-by-step explanation:

Assignments like this are easy in python, in the sense that no helper variables are needed!

User Dimas Mendes
by
5.7k points