Saturday, March 20, 2021

Swap of Two Numbers in Python

Write a program that will ask the user to input two numbers and then, swap the arrangement of the two numbers and display the result on the screen.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.





 Program Listing

# Jake R. Pomperada, MAED-IT, MIT

# March 20, 2021   Saturday   11:46 PM
# Bacolod City, Negros Occidental
print("@=====================================@")
print(" Swap of Two Numbers ")
print("@=====================================@")
print("");
x = int(input("Enter First Value : "))
y = int(input("Enter Second Value : "))
print("");
print("BEFORE SWAPPING")
print("");
print('The value of x before swapping: {}'.format(x))
print('The value of y before swapping: {}'.format(y))
temp = x
x = y
y = temp
print("");
print("AFTER SWAPPING")
print("");
print('The value of x after swapping: {}'.format(x))
print('The value of y after swapping: {}'.format(y))
print("")
print("===== THE END OF PROGRAM ===== ")

No comments:

Post a Comment