c# - Calculate hypotenuse from height and angle -
i'm bit rusty on math department , want calculate hypotenuse of right angle triangle given height (h) , opposite angle (c).
tried this:
double = h / math.sin(v);
the whole code snippet:
string line; while ((line = console.readline()) != null) { string[] split = line.split(new char[] { ' ' }, stringsplitoptions.none); long h = int64.parse(split[0]); long v = int64.parse(split[1]); double res = h / math.sin(v); console.writeline(res); }
however doesnt give me right answer. instance if height 10000 , angle c 89, hypotenuse should ~10001 ~11626. i've tried in javascript , c# same faulty answer, calculator gives correct answer. ideas of i'm doing wrong?
angle c must in radians not degrees
to radians use c * math.pi/180
Comments
Post a Comment