In this HackerRank Find Angle MBC problem solution in python, we need to develop a python program that can read two integer inputs separated with lines, and then we need to print the angle between them on the output screen.
Problem solution in Python 2 programming.
# Enter your code here. Read input from STDIN. Print output to STDOUT import math ab = float(raw_input()) bc = float(raw_input()) tang = ab / bc rad = math.atan(tang) print '{}°'.format(int(round(math.degrees(rad))))
Problem solution in Python 3 programming.
# Enter your code here. Read input from STDIN. Print output to STDOUT import math a = int(input()) b = int(input()) M = math.sqrt(a**2+b**2) theta = math.acos(b/M ) print(str(round(math.degrees(theta)))+'°')
Problem solution in pypy programming.
# Enter your code here. Read input from STDIN. Print output to STDOUT import math n = input() m = input() print str(int(round(math.degrees(math.atan2(n,m))))) + u'\N{DEGREE SIGN}'
Problem solution in pypy3 programming.
# Enter your code here. Read input from STDIN. Print output to STDOUT import math AB = float(input()) BC = float(input()) print(str(int(round(math.degrees(math.atan2(AB, BC)))))+'°')
0 Comments