Computer Science, asked by SabreGaming01, 6 months ago

Write a menu-driven program to accept the length and breadth of a rectangle and find the 1) Area 2) Perimeter​

Answers

Answered by pandeytrilokinath848
0

to accept lenght and breadth of a rectangle (1) area

Answered by faseelaandru
3

Python program

print("Type 1 to calculate rectangle area and perimeter and 2 to exit")

menu = input(''Enter what you want to do: ")

if(menu == '1'):

   length = float(input("Enter length of the rectangle: "))

   breadth = float(input("Enter breadth of the rectangle: "))

   area = length * breadth

   perimeter = 2*(length + breadth)

   print("The area of the rectangle is", area)

   print("The perimeter of the rectangle is", perimeter)

elif(menu == '2'):

  input() #to exit out of the console

else:

   print("Error")

   input() # to exit out of the console

Similar questions