Challenge: Print the Angles of a Triangle

Write a program to print the angles of a triangle.

Problem statement

Given three sides a, b, and c of a triangle, write a program to obtain and print the values of three angles AA, BB, and CC rounded to the next integer. Use the following formula:

a2=b2+c2−2bc(cosA)a^2 =b^2 +c^2 -2bc(cosA)

b2=a2+c2−2ac(cosB)b^2 =a^2 +c^2 -2ac(cosB)

c2=a2+b2−2ab(cosC)c^2 =a^2 +b^2 -2ab(cosC)

  • Input: The three sides, a, b, and c of a triangle will be given as inputs.
  • Output: Print the values of the three angles on the console.

Get hands-on with 1200+ tech skills courses.