Latest
Home » Python program to find area of triangle (given base and height)

# Python program to find area of triangle (given base and height) Hello everybody, welcome back! Here we learn how to find the area of a triangle when base and height of a triangle are given.

We calculate the area by multiplying base and height and dividing it with 2. `Area = ( base * height ) / 2`

You can also watch the video on YouTube here.

### July Promo - Limited Time Sale Limited time sale - 50% OFF Learn in-demand data and AI skills on the 17th of July

We can also calculate area of triangle when all sides are given, using Heron’s formula. That can be found here.

#### Area of triangle – Code Visualization

To find the area of a triangle when base and height of a triangle are given.

### July Promo - Limited Time Sale Limited time sale - 50% OFF Learn in-demand data and AI skills on the 17th of July

#### Approach :

• Read `base` and `height` of a triangle using `input()`or`raw_input()`
• Multiply both `base` and `height` and divide it with 2
• `Area a = ( base * height ) / 2`
• Print the result.

#### Program :

```b = float(input('Enter base of a triangle: '))
h = float(input('Enter height of a triangle: '))

area = (b * h) / 2
print('The area of the triangle is %0.2f' % area)```