# Lab 3

Lab Description:

In this lab we will create a program which can perform the follwing funtions by asking the user to enter the values:

1-      Sum numbers

2-      Subtract numbers

3-      Multiply numbers

4-      Divide numbers

5-      Remainder of numbers

6-      Compare numbers

7-      Exit

Source Code:

a = x+y
return a
def subtract (x,y):
b = x-y
return b
def multiply (x,y):
c = x*y
return c
def divide(x,y):
d = x/y
return d
def remainder(x,y):
e = x%y
return e
option = 1
while option > 0 and option < 7:
option = input (“Press any of the followint: 1.Add 2.Subtract 3.Multiply 4.Divide 5.Find remainder 6.Compare 7.Exit”)
if option == 1:
x = input (“Enter a value for x “)
y = input (“Enter a vaulue for y “)
elif option == 2:
x = input (“Enter a value for x “)
y = input (“Enter a vaulue for y”)
print subtract(x, y)
elif option == 3:
x = input (“Enter a value for x “)
y = input (“Enter a vaulue for y “)
print multiply(x ,y)
elif option == 4:
x = input (“Enter a value for x”)
y = input (“Enter a vaulue for y “)
print divide(x, y)
elif option == 5:
x = input (“Enter a value for x”)
y = input (“Enter a vaulue for y “)
print remainder(x, y)
elif option == 6:
x = input (“Enter a value for x “)
y = input (“Enter a vaulue for y “)
if x > y:
print (“X is greater than Y”)
elif x < y:
print (“X is less than Y”)
else:
print (“X is equal to Y”)

Screenshot:]