Computer Science, asked by manandhall480, 9 months ago

write a python program to calculate the area of shapes likes rectangle, square and circle

Answers

Answered by Equestriadash
29

choice = "Yes"

while choice == "Yes":

   print("1. Rectangle", "2. Square", "3. Circle")

   print("Select a shape whose area you'd like to find.")

   shape = input()

   if shape == 1:

       x = float(input("Enter the length: "))

       y = float(input("Enter the breadth: "))

       area = x*y

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

   elif shape == 2:

       x = float(input("Enter the length of a side: "))

       area = x**2

       print(area, "is the area of the square.")

   elif shape == 3:

       x = float(input("Enter the length of the radius: "))

       area = 3.14*x**2

       print(area, "is the area of the circle.")

   print()

   choice = input("Would you like to go again? [Yes/No]: ")

   print()

print("Thank you!")

Answered by kookiesandmilk
1

Answer:

Rectangle

l=float(input("Enter length"))

b=float(input("Enter breadth"))

area=l*b

print("area of rectangle is",area)

Square

s=float(input("Enter side"))

area=s*s

print("area of square is",area)

Circle

c=float(input("Enter radius"))

cr=3.14*c*c

print("area of circle is",cr)

Similar questions