In this HackerRank Find Angle MBC problem solution ABC is a right triangle, at B. and point M is the midpoint of the hypotenuse AC. and we have given the lengths AB and BC. and our task is to find MBC angle in degrees.


HackerRank Find Angle MBC in python problem solution

HackerRank Find Angle MBC problem solution

# -*- coding: UTF-8 -*-

import math

ab = int(input())
bc = int(input())
ac2 = ab**2 + bc**2
print(str(round(math.degrees(math.acos(-1*(ab**2 - bc**2 - ac2)/(2*bc*math.sqrt(ac2)))))))

Second solution in python 2 programming.

import math
import sys
l1 = float(raw_input())
l2 = float(raw_input())
a = math.degrees(math.atan(l1/l2))
a = round(a)
print "%.0f" % a,
sys.stdout.softspace=0
print u"\u00b0".encode('utf-8')