Skip to content

Commit cc0de2e

Browse files
committed
logic
Signed-off-by: Brian342 <migelbrian3@gmail.com>
1 parent 435d9db commit cc0de2e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

if_set1_3.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Write a program that prompts the user for two numbers and then computes them using the following rules.
2+
# If the first number is greater than the second one, the second number is subtracted from the first one.
3+
# If the second number is greater than the first one, the first number is divided by the second one.
4+
# Otherwise, the two numbers are added.
5+
num1 = int(input("Enter first number: "))
6+
num2 = int(input("Enter second number: "))
7+
8+
if num1 > num2:
9+
print("num1 - num2 = " + str(num1-num2))
10+
elif num1 < num2:
11+
print("num2 // num1 = " + str(num1 / num2))
12+
else:
13+
print("Num1 + num2 = " + str(num1 + num2))
14+
15+

0 commit comments

Comments
 (0)