# Python programs to calculate perimetrs and areas of triangle, rectangle and circle.

### Perimeters and areas of Triangle

the mathematical equation to calculate the perimeter and area of a Triangle with height(h), length(l) and width(w) is :
```p= h+l+w a=1/2(l*w) ```
so with python it can be executed as

``````length=float(input("Enter length : "))
width =float(input("Enter width : "))
height=float(input("Enter height: "))

print("the perimetre of the triangle is : " +str(length+width+height))
print("the area of the triangle is : " +str(1/2*(length*width)))
``````

and the output will be
``` Enter length : 2 Enter width : 3 Enter height: 4 the perimeter of the triangle is : 9.0 the area of the triangle is : 3.0 ```

### Perimeters and areas of rectangle

the mathematical equation to calculate the perimeter and area of a Rectangle with length(l) and width(w) is :
p= 2l + 2w
a= l*w
and the code will be

``````length=float(input("Enter length : "))
width =float(input("Enter width : "))

print("the perimeter of the rectangle is : "+str(2*length+2*width))
print("the area of the rectangle is : "+str(length*width))
``````

and the output will be
``` Enter length : 2 Enter width : 3 the perimeter of the rectangle is : 10.0 the area of the rectangle is: 6.0 ```

### Perimeters and areas of Circle

the mathematical equation to calculate the perimeter and area of a Circle with radius(r) is :
```p= 2*PI*r a=PI*r**2 ```
so with python it can be executed as

``````from math import pi
print("the Perimetre of the circle with radius "+str(r)+" is : " +str(2*pi*r))
print("the area of the circle with radius "+str(r)+" is : " +str(pi*r**2))
``````

and the output will be

```Enter radius : 3 the Perimeter of the circle with radius 3.0 is : 18.84955592153876 the area of the circle with radius 3.0 is : 28.274333882308138```