Cody

Problem 44273. Given a square and a circle, please decide whether the square covers more area.

Solution 2504714

Submitted on 9 Jun 2020 by Ramesh Kumar V
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
sq = 2; ci = 1; y_correct = (sq>ci); assert(isequal(sqci(sq,ci),y_correct))

a1 = 4 a2 = 0.7854 y = logical 1

2   Pass
sq = rand; ci = rand; y_correct = (4*sq^2>pi*ci^2); assert(isequal(sqci(sq,ci),y_correct))

a1 = 0.8831 a2 = 0.1998 y = logical 1

3   Pass
sq = 0; ci = 0; y_correct = (0>0); assert(isequal(sqci(sq,ci),y_correct))

a1 = 0 a2 = 0 y = logical 0

4   Pass
sq = 100; ci = 4; y_correct = (7>3); assert(isequal(sqci(sq,ci),y_correct))

a1 = 10000 a2 = 12.5664 y = logical 1

5   Pass
sq = 21; ci = 127; y_correct = (3>7); assert(isequal(sqci(sq,ci),y_correct))

a1 = 441 a2 = 1.2668e+04 y = logical 0

Community Treasure Hunt

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

Start Hunting!