68xi

   

"""
已知三角形的边长求他的面积和周长
Author:罗万财
Date:2017-3-3
"""
import math
a=float(input(\'a=\'))
b=float(input(\'b=\'))
c=float(input(\'c=\'))
if a+b>c and a+c>b and b+c>a:
    d=a+b+c 
    e=(a+b+c)/2 
    f=math.sqrt(e*(e-a)*(e-b)*(e-c))
    print(\'三角形的周长为:\'+str(d))
    print(\'三角形的面积为:%f\' % f)
else:
     print(\'三条变得长度不能构成三角形\')
结果:
a=3
b=4
c=5
三角形的周长为:12.0
三角形的面积为:6.000000

  

分类:

技术点:

相关文章:

  • 2021-09-07
  • 2021-12-19
  • 2021-12-19
  • 2022-12-23
  • 2021-12-19
  • 2021-12-19
猜你喜欢
  • 2021-12-19
  • 2021-12-19
  • 2021-12-19
  • 2021-12-19
  • 2021-12-19
  • 2021-09-06
相关资源
相似解决方案