Finding Area of Rectangle, Square, Circle and Triangle – Python Lab Program

FORMULA USED:
Area of triangle=1/2breadthheight

Area of the Square=lengthlength

Area of the rectangle=widthheight

Area of the circle=πradiusradius

ALGORITHM

Step 1: Start the program.
Step 2: Get the height and breadth of the triangle.
Step 3: Calculate area of triangle using the formula.

Area of triangle=1/2breadthheight
Step 4: Get the length of the square.
Step 5: Calculate area of the square using the formula.

Area of the Square=length*length

Step 6: Get the width and height of the rectangle.
Step 7: Calculate area of the rectangle using the formula.

Area of the rectangle=width*height.

Step 8: Get the radius of the circle.
Step 9: Calculate area of the circle using the formula.

Area of the circle=πradiusradius.

Step 10: Write the area of the triangle, square, rectangle and circle.
Step 11: End of the Program.

th=int(input("Enter the height of the triangle"))
tb=int(input("Enter the breadth of the triangle"))
tarea=float((0.5)*(tb)*(th))
sl=int(input("Enter the length of the square"))
sarea=float(sl*sl)
rw=int(input("Enter the width of the rectangle"))
rh=int(input("Enter the height of the rectangle"))
rarea=float(rw*rh)
cr=int(input("Enter the radius of the circle"))
carea=float((3.14)*cr*cr)
print(" AREA OF TRIANGLE")
print("The area of Triangle is {0}",tarea)
print(" AREA OF SQUARE")
print("The area of square is {0}",sarea)
print(" AREA OF RECTANGLE")
print("The area of rectangle is {0}",rarea)
print(" AREA OF CIRCLE")
print("The area of Triangle is {0}",carea)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.