Python Program to Calculate the Area of a Triangle

In this post, we will see how to calculate area of triange and print it in Python.


Problem

Calculate area of the triangle given three sides.


Solution

You can calcualte area of the traingle using Haron’s formula.
Here is simple python program to calculate area of the tringle.

# Three sides of triangle a=10 b=20 c=15 s=(a+b+c)/2 area=(s*(s-a)*(s-b)*(s-c))**0.5 print("Area of the triangle is: ",area)

Output:

Area of the triangle is: 72.61843774138907

That’s about calculating area of triange in python.

Leave a Reply

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