Computer Science, asked by nahu2, 10 months ago

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 third no.respectively

Answers

Answered by Anonymous
8

Answer:

def swapping(a, b, c):  

   # Store the sum of all three numbers in a

   a = a + b + c    

   b = a - (b+c)

   c = a - (b+c)

    a = a - (b+c)

   print("After swapping a =",a,", b =",b,", c =",c)  

 

if __name__ == '__main__':  

   a = 10

   b = 20

   c = 30

   print("Before swapping a =",a,", b =",b,", c =",c)  

   swapping(a, b, c)

Similar questions