Cody

Problem 42855. Height of a right-angled triangle

Solution 2203725

Submitted on 10 Apr 2020
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

This solution is outdated. To rescore this solution, sign in.

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));

y = 2.4000

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

y = NaN

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

y = 0

Assertion failed.

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

y = -2.4000

Assertion failed.

Suggested Problems

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!