A simple program to ask the user to give two numbers and then the program will compute the difference of the two numbers, and display the results 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 at my email address also. Thank you.
My mobile number here in the Philippines is 09173084360.
Program Listing
difference.py
# Python program to find difference between two numbers
# Author : Jake Rodriguez Pomperada, MAED-IT, MIT
# www.jakerpomperada.blogspot.com and www.jakerpomperada.com
# jakerpomperada@gmail.com
# Bacolod City, Negros Occidental Philippines
print()
print("\tDifference of Two Numbers in Python")
print()
num1 = int(input('Enter first number: '))
num2 = int(input('Enter second number: '))
# num1 is greater than num2
if num1 > num2:
diff = num1 - num2
# num1 is less than num2
else:
diff = num2 - num1
# Display the difference of two numbers
print()print('The difference between {0} and {1} is {2}.'.format(num1, num2, diff))print()
print("\tEnd of Program")
print()
No comments:
Post a Comment