232k views
2 votes
Write a program that reads in two integers typed on the keyboard and outputs their sum, difference, and product.

User AJak
by
7.9k points

1 Answer

4 votes
# Written in python

a = int(input("Enter an integer: "))
b = int(input("Enter an integer: "))

sum = a + b

# subtract the smaller number from the bigger
if a < b:
dif = a - b
else:
dif = b - a

prod = a * b

print("The sum is", sum)
print("The dif is", dif)
print("The product is", prod)
User Sebastian Ax
by
8.2k points