You are on page 1of 2

Simple Calculator with Integer Type:

a = int(input())

b = int(input())

print("Enter 1 for Plus, 2 for Subtract, 3 for Multiplication, 4 for Division")

c = int(input())

if c == 1:

print(a+b)

elif c == 2:

print(a-b)

elif c== 3:

print(a*b)

elif c == 4:

if a > b:

print(a/b)

else:

print(b/a)

else:

print("Wrong Input")

Simple Calculator with String Type:


a = int(input())

b = int(input())

print("Enter 1 for Plus, 2 for Subtract, 3 for Multiplication, 4 for Division")

c = int(input())
if c == '1':

print(a+b)

elif c == '2':

print(a-b)

elif c== '3':

print(a*b)

elif c == '4':

if a > b:

print(a/b)

else:

print(b/a)

else:

print("Wrong Input")

You might also like