find area of a triangle with 3 sides code example
Example 1: how to find the area of a triangle
#this is the code to find the area of a parrelogram and triangle
#change the numbers to select what height and base your shape is
b = 3 #b is base
h = 3 #h is height (middle)
t = 5 #this is the base of the triangle
i = 5 #and this is the height
p = t*i #dont touch this
print("this is the area of the parrelogram")
print(b * h)
m = input("do you want to calculate a triangle? (space before answer)")
print(m)
if m == " yes":
print ("this is the area of the triangle that you inputed")
print (p/2)
else:
print("ok")
Example 2: how to find a point on a triangle with only sides
known sides AB, BC, AC
known points A(x, y), B(x, y)
unknown points C(x, y)
AC² - BC² = ((Ax - Cx)² + (Ay - Cy)²) - ((Bx - Cx)² + (By - Cy)²)
Goal:
C.x = ?
C.y = ?