codemaniacstudio

Write a Python program to enter two angles of a triangle and find the third angle.

Write a Python program to enter two angles of a triangle and find the third angle.

PROGRAM

# Python program to find the third angle of a triangle (no if-else)
# Input two angles from the user
angle1 = float(input(“Enter the first angle of the triangle: “))
angle2 = float(input(“Enter the second angle of the triangle: “))
# Calculate third angle
angle3 = 180 – (angle1 + angle2)
# Display the result
print(f”The third angle of the triangle is: {angle3} degrees”)

OUTPUT

TRY THE ABOVE CODE

Exit mobile version