write a program to calculate area of a triangle using heron’s formula.

#calculate herons formula
import math 
a=float(input("enter the first side"))
b=float(input("enter the second side"))
c=float(input("enter the third side"))
d=a+b+c
s=d/2
x=(s-a)*(s-b)*(s-c)
y=s*x
area=math.sqrt(y)
print("therefore the area =",area)


Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
= RESTART: C:\Users\Dell\AppData\Local\Programs\Python\Python38-32\herons formula.py
enter the first side150
enter the second side120
enter the third side200
therefore the area = 8966.569856974293
>>> 

Leave a Reply

Back To Top