Lab 3


For lab 3, we had to do another control flow but this time it would have an exit so the program exits.


#Mabel Fermin
#Lab 3 – Control Flow
#Date: 2/26/13
#Session: 9310

x = int(input (‘enter the first number:’))
y = int(input (‘enter the second number: ‘))
print (‘enter 1 to add the numbers’)
print (‘enter 2 to substract the numbers’)
print (‘enter 3 to multiply the numbers’)
print (‘enter 4 to divide the numbers’)
print (‘enter 5 to find the remainder of x%y’)
print (‘enter 6 for x<=y’)
print (‘enter 7 to exit the program’)
z = int(input(‘enter your selection:’))
if z==1:
result = x+y
print (‘the sum of ‘,x,’ and ‘,y,’ is: ‘,result)
elif z==2:
result = x-y
print (‘the difference of ‘,x,’ and ‘,y,’ is: ‘,result)
elif z==3:
result= x*y
print (‘the product of ‘,x,’ and ‘,y,’ is: ‘,result)
elif z==4:
result= x/y
print(‘the quotient of ‘,x,’ and ‘,y,’ is: ‘,result)
elif z==5:
result= x%y
print(‘the remainder of ‘,x,’ and ‘,y,’ is: ‘,result)
if x<=y:
if x = y then (‘the numbers are equals’,result)
elif x < y then (‘,x,’ is less than ‘,y,’,result)
else x > y then (‘,x,’ is greater than ‘,y,’ result)