Computer Science, asked by seenasureshkmd, 9 months ago

wap to find the perimeter of square, circle and rectangle using same function name ie, perimeter () use different argument type method​

Answers

Answered by Anonymous
1

Answer:

its a python program

Explanation:

# program to find the perimeter of the rectangle,square and circle using the same function

def perimeter(figure):

   if figure=="circle":

       r=int(input("enter the radius"))

       c=2*3.14*r

       print(c)

   elif figure=="rectangle":

       l=int(input("enter the length"))

       b=int(input("enter the breadth"))

       p=l*b

       print(p)

   elif figure=="square":

       a=int(input("enter the side"))

       p=4*a

       print(p)

   else:

       print("sorry out of range")

#main

f=str(input("enter the figure"))

perimeter(f)

Similar questions