This lab was made to do simple math problems.
# Mohan Dindial
# lab 2 – Control Flow
# Date: 2, 26, 2013
# Session: 9310
x = input (‘Enter the first number: ‘)
y = input (‘Enter the second number: ‘)
print (‘Enter 1 to add the numbers’)
print (‘Enter 2 to subtract the numbers’)
print (‘Enter 3 to multiple the numbers’)
print (‘Enter 4 to divide the numbers’)
print (‘Enter 5 to get the remainder of the numbers’)
print (‘Enter 6 to see whether x is less than, equal, or greater than y’)
z = 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
elif z ==6:
if x<y:
print (x,”less than”,y)
if x>y:
print (x,”is greater than”,y)
elif x ==6:
print (x,”is equal to”,6)
x = input (‘Enter the first number: ‘)
y = input (‘Enter the second number: ‘)
x = x
while x>0:
print x
x = x-1
print “the last number:”,x
y = y
while y>0:
print y
y = y-1
print “the last number:”, y