DEV Community

Discussion on: Daily Challenge #84 - Third Angle of a Triangle

Collapse
 
mbaas2 profile image
Michael Baas • Edited

Solution in APL

(using Dyalog APL)

thirdAngle←{r←180-+/⍵ ⋄ (r<0)∨0∊⍵: 'This is not a triangle!' ⋄ r}

Tests:

      thirdAngle 30 60
90
      thirdAngle 60 60
60
      thirdAngle 43 78
59
      thirdAngle 10 20
150

Try it online!