You are on page 1of 2

AREA OF GEOMETRIC FIGURE

pi=3.14
def square():
a=float(input("enter a side of square:"))
aq=a*a
print("area of square=",aq)
def rectangle():
l=float(input("enter a side of length:"))
b=float(input("enter a side of breadth:"))
ar=l*b
print("area of rectangle=",ar)
def circle():
r=float(input("enter a side of radius:"))
ac=pi*r*r
print("area of circle=",ac)
def triangle():
b=float(input("enter a side of breadth:"))
h=float(input("enter a side of height:"))
at=0.5*(b*h)
print("area of triangle=",at)
while True:
print(" \n 1.area of square:")
print(" \n 2.area of rectangle:")
print(" \n 3.area of circle:")
print(" \n 4.area of triangle:")
print(" \n 5.exit \n")
choice=int(input("Enter the from 1 to 5:"))
if choice==1:
square()
elif choice==2:
rectangle()
elif choice==3:
circle()
elif choice==4:
triangle()
elif choice==5:
break
else:
print("just give the choices 1 to 5")

OUTPUT:

1.area of square:
2.area of rectangle:
3.area of circle:
4.area of triangle:
5.exit
Enter the from 1 to 5:1
enter a side of square:5
area of square= 25.0
1.area of square:
2.area of rectangle:
3.area of circle:
4.area of triangle:
5.exit
Enter the from 1 to 5:2
enter a side of length:9
enter a side of breadth:10
area of rectangle= 90.0
1.area of square:
2.area of rectangle:
3.area of circle:
4.area of triangle:
5.exit
Enter the from 1 to 5:3
enter a side of radius:6
area of circle= 113.03999999999999
1.area of square:
2.area of rectangle:
3.area of circle:
4.area of triangle:
5.exit
Enter the from 1 to 5:4
enter a side of breadth:7
enter a side of height:8
area of triangle= 28.0
1.area of square:
2.area of rectangle:
3.area of circle:
4.area of triangle:
5.exit
Enter the from 1 to 5:5
>>>

You might also like