Lab 2

Lab Description:

This is a program that people can use for some easy calculations.

Code:

option=1 
while option < 2:
    option = input("select and option: (1)enter numbers (2)exit")
    if (option ==2):
        exit
    elif (option ==1):
        x=input ("enter value x")
        y= input ("enter value y")
        z=x+y
        print "z=x+y"
        print z
        a=x-y
        print "a=x-y"
        print a
        b=x*y
        print "b=x*y"
        print b
        c=x/y
        print "c=x/y"
        print c
        d=x%y
        print "d=x%y"
        print d
        if x < y:
            print 'x is greater than y'
        elif y < x:
            print 'y is greater than x'
        else: 
            print 'x and y are equal'

Screenshot:

lab2

Leave a Reply

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