Lab 2

I had to write a program that asks the user to enter two integer numbers x and y. The program should perform the following operations and display the results back. This program was a little complicated  because i could not finish the program.

x = input (“Enter x: “)

y = input (“Enter y: “)

while x != 0:
a_sum = x + y
print ‘x + y = ‘, a_sum

difference = x – y
print ‘x – y = ‘, difference

product = x * y;
print ‘x * y = ‘, product

quotient = x / y;
print ‘x / y = ‘, quotient

remainder = x % y;
print ‘x % y = ‘, remainder;

if x == y:
print ‘x and y are equal’
if x < y:
print ‘x is less than y’
else:
print ‘x is greater than y’

x = input (“Enter x: “)
y = input (“Enter y: “)

 

The result was:Capture66

 

Leave a Reply

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