Lab 2

Description:

In lab 2 we had to make a small calculating program which would interact with user. This program asks you to put any two numbers in, then program will calculate the sum, difference, product, quotient, and remainder of those two numbers and display it to you. After the first set done you can repeat the process as many times as you want, until you decide to exit.

Code:

option = input ("Press: (1)Enter numbers (2)Exit ")
while option == 1:
    x = input (" Enter x: ")
    y = input (" Enter y: ")
    print (' Value of X is', x)
    print (' Value of Y is', y)
    print (' The sum of X and Y is: ', x+y)
    print (' The difference of X and Y is:', x-y)
    print (' The product of X and Y is:', x*y)
    print (' The quotient of X and Y is:', x/y)
    print (' The remainder of X and Y is:', x%y)
    if x  y:
        print (' X is greater than Y ')
    option = input ("Press: (1)Enter numbers (2)Exit ")
   

Screenshots:

screen 1screen 3 screen 2screen 4

 

Leave a Reply

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