Python Program to Calculate the Area of a Triangle

we are using below formula to calculate area of triangle

s = (a+b+c)/2
area = √(s(s-a)*(s-b)*(s-c))

 

a = 4

b = 5

c = 6


# calculate the semi-perimeter of triangle


s = (a + b + c) / 2


# calculate the area of triangle


area = (s*(s-a)*(s-b)*(s-c)) ** 0.5

print('The area of the triangle is %0.2f' %area)
output:-

Leave a Reply

Your email address will not be published. Required fields are marked *