Python 判断三个数能否构成三角形并计算面积
a = float(input()) b = float(input()) c = float(input())
if a + b > c and a + c > b and b + c > a: p = (a + b + c) / 2 area = (p * (p - a) * (p - b) * (p - c)) ** 0.5 print('YES') print('{:.2f}'.format(area)) else: print('NO')
原文地址: https://www.cveoy.top/t/topic/orlz 著作权归作者所有。请勿转载和采集!