Write a Python program to swap two numbers using a temporary variable.

                                      

Write a Python program to swap two numbers using a temporary variable.


PROGRAM:

n1=float(input("Enter a number1 before swapping:"))
n2=float(input("Enter a number2 before swapping:"))
temp=n1
n1=n2
n2=temp
print("number1 after swapping:",n1)
print("number2 after swapping:",n2)

OUTPUT:

No comments:

Post a Comment




Copyright Ⓒ 2022 | Mechpedia | All Right Reserved.