Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 341691

Submitted on 29 Oct 2013 by J-G van der Toorn

Correct

53Size
Leading solution size is 28.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Pass
 
%%
x1=0;y1=0;x2=10;y2=6
N = 14;
assert(isequal(sqrnbr(x1,y1,x2,y2),N));
y2 =
     6
2
Pass
 
%%
x1=0;y1=1;x2=10;y2=21
N = 20;
assert(isequal(sqrnbr(x1,y1,x2,y2),N));
y2 =
    21
3
Pass
 
%%
x1=0;y1=3.5;x2=10;y2=3.5
N = 10;
assert(isequal(sqrnbr(x1,y1,x2,y2),N));
y2 =
    3.5000