Below is a right-angled triangle:

```
  |\
  | \
  |  \
  |   \ 
o |    \ h 
  |     \
  |    θ \
  |_______\ 
     a
```

Your challange is to write a function (```missingAngle``` in C/C#, ```missing_angle``` in Ruby), that calculates the angle θ in degrees to the nearest integer. You will be given three arguments representing each side: o, h and a. One of the arguments equals zero. Use the length of the two other sides to calculate θ. You will not be expected to handle any erronous data in your solution.

Source: codewars | Difficulty: EASY
Tags: Geometry

Mathematics

Starter code: def missing_angle(h, a, o):
	

Solutions:
import math

def missing_angle(h, a, o):
	if h == 0:
		radians = math.atan(o / a)
	elif a == 0:
		radians = math.asin(o / h)
	else:
		radians = math.acos(a / h)
	return round(math.degrees(radians))


from math import asin, acos, atan, degrees as d
missing_angle = lambda h, a, o: round(d(atan(o / a) if not h else asin(o / h) if not a else acos(a / h)))


import math

def missing_angle(h, a, o):
	return round(math.degrees(math.atan(o / a) if not h else math.asin(o / h) if not a else math.acos(a / h)))


from math import sqrt, asin, degrees

def missing_angle(h, a, o):
	(h, o) = (h or sqrt(a ** 2 + o ** 2), o or sqrt(h ** 2 - a ** 2))
	return round(degrees(asin(o / h)))


from math import asin, acos, atan, pi

def missing_angle(h, a, o):
	ans = acos(a / h) if h * a else atan(o / a) if a * o else asin(o / h)
	return round(ans * 180 / pi)


import math

def missing_angle(h, a, o):
	if h > 0 and a > 0:
		result = math.acos(a / h)
	elif a == 0 and o > 0:
		result = math.asin(o / h)
	elif h == 0 and o > 0:
		result = math.atan(o / a)
	else:
		raise ValueError('Invalid argument(s)')
	return round(math.degrees(result))


import math

def missing_angle(h, a, o):
	if not h:
		h = (a ** 2 + o ** 2) ** 0.5
	if not o:
		o = (h ** 2 - a ** 2) ** 0.5
	return round(math.asin(o / h) * 180 / math.pi)