Program in python to input any choice and calculate area of square/rectangle/triangle


Write a program in python to input any choice and implement the following-

1. Area of Square

2. Area of Rectangle

3. Area of Triangle 

-----------------------------------------------

ch = input ("Enter any Choice")

if(ch==1):

    s = input("enter any side of the square")

    a = s*s

    print("Area = ",a)

elif(ch==2):

    l = input("enter length")

    b = input("enter breadth")

    a = l*b

    print("Area = ",a)

elif(ch==3):

    x = input("enter first side of triangle")

    y = input("enter second side of triangle")

    z = input("enter third side of triangle")

    s = (x+y+z)/2

    A = ((s-x)*(s-y)*(s-z))**0.5

    print("Area=",A)

else:

    print ("Wrong input")

--------------------------------------------------



Post a Comment

0 Comments