Reputation: 11
import math
a = 5
b = 7
C = 49
c = (a**2)+(b**2)-(2*a*b*(math.cos(C)))
gc = math.sqrt(c)
print(gc)
It outputs 7.27726060671 when it should output something like 5.3. Any help would be very appreciated.
-Cam
Upvotes: 0
Views: 213
Reputation: 43534
You need to convert to radians first:
Try:
c = (a**2)+(b**2)-(2*a*b*(math.cos(math.radians(C))))
print(math.sqrt(c))
#5.29866662196
Upvotes: 2