...
This commit is contained in:
parent
051504d65b
commit
0457928c3e
295 changed files with 3588 additions and 3 deletions
14
Task/Arithmetic-Integer/Python/arithmetic-integer-1.py
Normal file
14
Task/Arithmetic-Integer/Python/arithmetic-integer-1.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
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( )
|
||||
Loading…
Add table
Add a link
Reference in a new issue