Problem 2022. Find a Pythagorean triple
Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them comprise sides of a right-angled triangle. Return true if they do, otherwise return false .
Solution Stats
Problem Comments
-
11 Comments
Show
8 older comments
Gairik Sarkar
on 17 May 2024
roundup the numbers before comparing
Sophia
on 28 May 2024
I think for Test-7 , problem creator @Tanya should add "~" to the "flag_correct" part of the line:
assert(isequal(isTherePythagoreanTriple(a, b, c, d),flag_correct))
so it should be changed to :
assert(isequal(isTherePythagoreanTriple(a, b, c, d),~flag_correct))
Sunil
on 20 Jun 2024
Pythagorean triplets are taken as positive integers , one of the test case uses irrational number for inputs ! I wish the test creator
@Tanya Morton makes appropriate change as suggested by @Sophia
Solution Comments
Show commentsProblem Recent Solvers4681
Suggested Problems
-
1751 Solvers
-
The Hitchhiker's Guide to MATLAB
3323 Solvers
-
Convert a vector into a number
602 Solvers
-
738 Solvers
-
8328 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!