import math
#taking input from user
a = float(input('Enter first side of triangle: '))
b = float(input('Enter second side of triangle: '))
alpha = float(input('Enter angle between a and b: '))
#finding third side of triangle
c = math.sqrt((math.pow(a, 2)+math.pow(b, 2)) - 2*a*b*(math.cos(alpha)))
print('third side of triangle is: ', c)
#calculate perimeter
s = ((a+b+c)/2)
print('perimeter of triangle is: ', s)
#calculate area
area = math.sqrt(s*(s-a)*(s-b)*(s-c))
print('Area of triangle is: ', area)
作为一个新的程序员,我知道如何使程序取两个数字,我有问题,这个程序应该如何取90度角
程序如何计算第三方(c)
像这样
相关问题 更多 >
编程相关推荐