Cody

Problem 47048. Area of a triangle given its sides

Solution 3442413

Submitted on 27 Oct 2020 at 20:32 by Wesley Maa
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)

s = 6 y = 6

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

s = 8.5000 y = "Not a triangle!"

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

s = 1 y = "Not a triangle!"

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

s = 3.5000 y = "Not a triangle!"

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

s = 5.5000 y = 5.5621

Suggested Problems

Community Treasure Hunt

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

Start Hunting!