File tree
Expand file treeCollapse file tree1 file changed
+21
-0
lines changed Expand file treeCollapse file tree1 file changed
+21
-0
lines changed Original file line number | Diff line number | Diff line change |
---|
|
| 1 | +# Store input numbers: |
| 2 | +num1 = input('Enter first number: ') |
| 3 | +num2 = input('Enter second number: ') |
| 4 | + |
| 5 | +# Add two numbers |
| 6 | +sum = float(num1) + float(num2) |
| 7 | +# Subtract two numbers |
| 8 | +min = float(num1) - float(num2) |
| 9 | +# Multiply two numbers |
| 10 | +mul = float(num1) * float(num2) |
| 11 | +#Divide two numbers |
| 12 | +div = float(num1) / float(num2) |
| 13 | +# Display the sum |
| 14 | +print('The sum of {0} and {1} is {2}'.format(num1, num2, sum)) |
| 15 | + |
| 16 | +# Display the subtraction |
| 17 | +print('The subtraction of {0} and {1} is {2}'.format(num1, num2, min)) |
| 18 | +# Display the multiplication |
| 19 | +print('The multiplication of {0} and {1} is {2}'.format(num1, num2, mul)) |
| 20 | +# Display the division |
| 21 | +print('The division of {0} and {1} is {2}'.format(num1, num2, div)) |
You can’t perform that action at this time.
0 commit comments