본문 바로가기
알고리즘/Codewars

[Codewars] Third Angle of a Triangle (8 kyu) / JavaScript

by fluss 2023. 3. 12.

https://www.codewars.com/kata/5a023c426975981341000014

 

Codewars - Achieve mastery through coding practice and developer mentorship

A coding practice website for all programming levels – Join a community of over 3 million developers and improve your coding skills in over 55 programming languages!

www.codewars.com

 

DESCRIPTION:

You are given two interior angles (in degrees) of a triangle.

Write a function to return the 3rd.

Note: only positive integers will be tested.

https://en.wikipedia.org/wiki/Triangle

 

코드

function otherAngle(a, b) {
  return 180 - (a + b);
}

댓글