RosettaCodeData/Task/Arithmetic-Integer/Python/arithmetic-integer-1.py

15 lines
522 B
Python
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
x = int(raw_input("Number 1: "))
y = int(raw_input("Number 2: "))
print "Sum: %d" % (x + y)
print "Difference: %d" % (x - y)
print "Product: %d" % (x * y)
print "Quotient: %d" % (x / y) # or x // y for newer python versions.
# truncates towards negative infinity
print "Remainder: %d" % (x % y) # same sign as second operand
print "Quotient: %d with Remainder: %d" % divmod(x, y)
print "Power: %d" % x**y
## Only used to keep the display up when the program ends
raw_input( )