Lab 2

Lab Description:

In this lab we create a program to complete the follwing operations and displays result:

1-      x + y

2-      x – y

3-      x * y

4-      x/y

5-      x%y

6-      Whether x is less than, equal, or greater than y

Source Code:
option = 1
while option == 1:
option = input (“Press (1) to enter numbers or (2) to exit”)
if option == 1:
x = input (“enter value for x”)
y = input (“enter value for y”)
a = x+y
b = x-y
c = x*y
d = x/y
e = x%y
print a
print b
print c
print d
print e
if x > y:
print (“x is greater less than y”)
elif x == y:
print (“x is equal to y”)

else :
print (“x is less than y”)

Screenshot:

Snap 2013-11-01 at 09.15.57

 

Leave a Reply

Your email address will not be published. Required fields are marked *