已知:三角形的三个边长a,b,c ,求三角形的面积?
海伦公式:
s=(a+b+c)/2
import cmath
a = 3
b = 4
c = 5
p = 0.5*(a+b+c)
m = p*(p-a)*(p-b)*(p-c)
c = m**0.5
print(c)
微信扫一扫
已知:三角形的三个边长a,b,c ,求三角形的面积?
海伦公式:
s=(a+b+c)/2
import cmath
a = 3
b = 4
c = 5
p = 0.5*(a+b+c)
m = p*(p-a)*(p-b)*(p-c)
c = m**0.5
print(c)
相关推荐