(Python)
Problem Statement:

ABC is a right triangle, 90° at B.
Therefore, ∠ ABC = 90.
Point M is the midpoint of the hypotenuse.
You are given the lengths AB and BC.
Your task is to find ∠MBC (angle θ, as shown in the figure) in degrees.
Input Format
The first line contains the length of side AB.
The second line contains the length of the side BC.
Constraints
- 0 < AB <= 100
- 0 < BC <= 100
- Lengths AB and BC are natural numbers.
Output Format
Output ∠MBC in degrees.
Note: Round the angle to the nearest integer.
Examples:
If the angle is 56.5000001°, then output 57°.
If the angle is 56.5000000°, then output 57°.
If the angle is 56.4999999°, then output 56°.
0° < θ° < 90°
Sample Input
1010
Sample Output
45°
Solution:
# Enter your code here. Read input from STDIN. Print output to STDOUTimport mathAB = int(input())BC = int(input())Angle_ABC = 90AC = pow(AB^2+BC^2, 1/2)theta = round(math.degrees(math.atan(AB/BC)))#print(f"{theta}\u00B0")print(str(theta)+chr(176))
Output:

Note:
a + b + c = 180
ac = sqrt(a^2 + b^2)
ma = mb = mc – midpoint theorem
theta = mbc
mcb = mbc – midpoint theorem
sin(theta) = ab/ac
cos(theta) = bc/ac
tan(theta) = ab/bc
theta = arctan(ab/bc)
arctan is the inverse tangent of a given angle.
You can use numpy arctan or math atan.
Refer:
numpy.arctan2 — NumPy v2.4 Manual
math — Mathematical functions — Python 3.14.4 documentation
Reference:
