21. Python Program to find Area of Triangle if three sides are given.
How does this program work?
- In this program you are going to learn about how to find out the Area of triangle if three sides are given using Python.
- In this program to take user inputs three values for the given Triangle. And these three values can be store in three different variables.
- After that by using area of triangle formula we can get the Output.
Here is the code
import math
def AOT(a,b,c,p):
area = math.sqrt(p * (p - a) * (p - b) * (p - c))
return area
a = int(input("Enter the first side of a triangle: "))
b = int(input("Enter the second side of a triangle: "))
c = int(input("Enter the third side of a triangle: "))
p = (a+b+c)/2
print("Area of triangle: ",AOT(a,b,c,p))