Cody

Problem 42855. Height of a right-angled triangle

Solution 1881047

Submitted on 22 Jul 2019 by HH
• Size: 7
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Pass
a = 3; b = 4; c = 5; y_correct = 2.4; assert(isequal(triangle_height(a, b, c), y_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In triangle_height (line 2) In ScoringEngineTestPoint1 (line 6) In solutionTest (line 3)]

2   Pass
a = 1; b = 2; c = 3; y_correct = NaN; assert(isequaln(triangle_height(a, b, c), y_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In triangle_height (line 2) In ScoringEngineTestPoint2 (line 6) In solutionTest (line 5)]

3   Pass
a = 0; b = 1; c = 1; y_correct = NaN; assert(isequaln(triangle_height(a, b, c), y_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In triangle_height (line 2) In ScoringEngineTestPoint3 (line 6) In solutionTest (line 7)]

4   Pass
a = -3; b = -4; c = -5; y_correct = NaN; assert(isequaln(triangle_height(a, b, c), y_correct));

[Warning: Function assert has the same name as a MATLAB builtin. We suggest you rename the function to avoid a potential name conflict.] [> In unix (line 32) In triangle_height (line 2) In ScoringEngineTestPoint4 (line 6) In solutionTest (line 9)]