Find Angle MBC

Sort by

recency

|

857 Discussions

|

  • + 0 comments
    import math
    a= float(input())
    b = float(input())
    r = math.atan2(a,b)
    d = math.degrees(r)
    print(int(round(d)),chr(176),sep="")
    
  • + 0 comments

    HackerRank is one of the best learning platforms because it not only challenges you with interesting problems but also provides interactive coding exercises and instant feedback, helping you learn by doing. Fairplay 24.in

  • + 2 comments
    import math
    AB = float(input())
    BC = float(input())
    rad = math.atan(AB/BC)
    deg = math.degrees(rad)
    print(int(round(deg)),chr(176),sep='')
    

    In Right-angled Triangle , Mid point in hypotenuse always equidistant from 3 sides meas here angle is tan-inv(ab/bc).

    • + 0 comments

      wow,so simplified

    • + 0 comments

      shouldn't it be divided by 2? it's looking for MBC not ABC

  • + 0 comments

    I had to refresh high school trigonometry.

    from math import sqrt, cos, acos, asin, sin, degrees
    
    ab = float(input())
    bc = float(input())
    
    # Pythagoras theorem
    ac = sqrt(ab**2 + bc**2)
    mc = ac/2
    
    # definition of cos and sin, delta is angle ACB
    cos_delta = bc/ac
    sin_delta = ab/ac
    
    # law of cosines to find mb
    mb = sqrt(bc**2 + mc**2 - 2*bc*mc*cos_delta)
    
    # law of sines to find sin_theta
    sin_theta = (mc*sin_delta)/mb
    
    print(f"{round(degrees(asin(sin_theta)))}\N{DEGREE SIGN}")
    
  • + 0 comments

    The thing that really got to my heart is that you have to print the "correct" degrees symbol, which is the one with code 176. Mind you, don't dare to copy&paste it and then execute the program, since it does not accept non ASCII characters.

    Yeah, substitute ° with chr(176). Sigh.