DEV Community

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

Collapse
 
willsmart profile image
willsmart

Keeping it simple in bash

function thirdAngle {
  echo $((180 - $1 - $2))
}

Running through the examples on the cmd:

> thirdAngle 30 60
90

> thirdAngle 60 60
60

> thirdAngle 43 78
59

> thirdAngle 10 20
150
Collapse
 
willsmart profile image
willsmart

BTW the challenge on Kata only tests for valid triangles,

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

was sufficient in JS