Hello, Need help with this question. Question is as follows: 2.) The area of a rectangle is the rectangle's length times its width. Design a program that asks for the length and the width of two rectangles. The program should tell the user which of the two rectangles has the greater area, or whether the two areas are the same. All programming is in Python
Hello,
Need help with this question.
Question is as follows:
2.) The area of a rectangle is the rectangle's length times its width. Design a program that asks for the length and the width of two rectangles. The program should tell the user which of the two rectangles has the greater area, or whether the two areas are the same.
All
print('enter the length of first rectangle')
l1=int(input())#to read length of first rectangle
print('enter the width of first rectangle')
w1=int(input())#to read width of second rectangle
print('enter the length of secong rectangle')
l2=int(input())#to read length of second rectangle
print('enter the width of second rectangle:')
w2=int(input())#to read width of second rectangle
area1=l1*w1#to find area of first rectangle
area2=l2*w2#to find area of second rectangle
if(area1>area2):#to compare area of both rectangles
print('Area of first rectangle is greater than second')
elif(area2>area1):
print('Area of second rectangle is greater than first')
else:
print('Both rectangles has same area')
Step by step
Solved in 3 steps with 4 images