47
4
Given a, b, c
the length of the three sides of a triangle, say if the triangle is right-angled (i.e. has one angle equal to 90 degrees) or not.
Input
Three positive integer values in any order
Output
Either a specific true output (true
, 1
, yes
, ...) or a specific false output (false
, 0
, no
, ...)
Example
5, 3, 4 --> yes
3, 5, 4 --> yes
12, 37, 35 --> yes
21, 38, 50 --> no
210, 308, 250 --> no
Rules
- The input and output can be given in any convenient format.
- In your submission, please state the true and the false values.
- No need to handle negative values or invalid edge triple
- Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
- If possible, please include a link to an online testing environment so other people can try out your code!
- Standard loopholes are forbidden.
- This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.
1Must we handle negative values or invalid edge triple? – user202729 – 2017-10-23T14:57:31.897
@user202729 No ;) – mdahmoune – 2017-10-23T14:59:07.980
2Very related. I'll leave it up to the rest of the community to decide if its a dup. – Digital Trauma – 2017-10-23T17:18:00.357
2I think that using coordinates instead of lengths changes the challenge significantly – Luis Mendo – 2017-10-23T18:24:13.737
8
There is no triangle with lengths
– Kevin – 2017-10-23T22:31:37.29721, 38, 5
, because 21 + 5 < 38. Is this an intentional pathological case that we have to handle?1@Kevin no you have not to handle this case. User202729 has already asked this question :) – mdahmoune – 2017-10-24T06:44:03.660