Given three positive numbers a, b, c, where c is the largest number, return true if the triangle with sides a, b and c is right-angled. Otherwise, return false.
This is a good problem to refresh basic geometry
The checking should include a random Pythagorean triple (given random natural numbers a>b: a^2-b^2, 2ab, and a^2+b^2 form a Pythagorean triple). For the checking right now, a~=2 passes the tests.
Basic triangle math plus if statements. Great example
This reminds me the old good days ... basic geometry as Sreeram Mohan said :)
Brain clearance
What is wrong with this code?
use
if c==sqrt(a^2 + b^2)
flag=true
else
flag=false
Should add tolerance of 10*eps to make this function practical. Otherwise you can have a triangle with a 89.9999999 deg angle and it will say it is not a right triangle. Matlab is a numerical language.
This user (mohamed elbesealy) appears to have gamed the system, with fraudulent "likes" of this unremarkable solution submitted by 'sock-puppet' accounts. —DIV
mmm c is always grater than a and b
This problem was repeated
Replace NaNs with the number that appears to its left in the row.
1735 Solvers
Magic is simple (for beginners)
1216 Solvers
200 Solvers
The sum of the numbers in the vector
345 Solvers
395 Solvers