Cody

Problem 47048. Area of a triangle given its sides

Solution 3350023

Submitted on 23 Oct 2020 by William
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 = 5;b = 4;c = 3; y_correct = 6; assert(abs(AreaOfTriangle(a,b,c) - y_correct) < 1e-3)

2   Pass
a = 10;b = 4;c = 3; y_correct = 'Not a triangle!'; assert(isequal(AreaOfTriangle(a,b,c),y_correct))

3   Pass
a = -5;b = 4;c = 3; y_correct = 'Not a triangle!'; assert(isequal(AreaOfTriangle(a,b,c),y_correct))

4   Pass
a = 0;b = 4;c = 3; y_correct = 'Not a triangle!'; assert(isequal(AreaOfTriangle(a,b,c),y_correct))

5   Pass
a = 4;b = 4;c = 3; y_correct = 5.5621; assert(abs(AreaOfTriangle(a,b,c) - y_correct) < 1e-3)

Suggested Problems

Community Treasure Hunt

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

Start Hunting!