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 :)
flag = true;
flag = false;
What is wrong with this code?
if c==sqrt(a^2 + b^2)
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
Sums with Excluded Digits
Knight's Tour Checker
Given an unsigned integer x, find the largest y by rearranging the bits in x
Rotate a Matrix
Matlab Basics - Convert a row vector to a column vector
Length of a short side
Dimensions of a rectangle
Side of an equilateral triangle
Length of the hypotenuse
Is this triangle right-angled?
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office