Cody

Problem 45536. Distance Between Points

Solution 2291385

Submitted on 18 May 2020 by George Iskander
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
n = 5; x = 80; y = 150; assert(isequal(distance(n,x),y))

y = 30 y = 70 y = 150

2   Pass
n = 2; x = 64; y = 64; assert(isequal(distance(n,x),y))

3   Pass
n = 8; x = 1600; y = 3175; assert(isequal(distance(n,x),y))

y = 75 y = 175 y = 375 y = 775 y = 1575 y = 3175

4   Pass
n = 3; x = 2500; y = 3750; assert(isequal(distance(n,x),y))

y = 3750

5   Pass
n = 8; x = 1000000; y = 1984375; assert(isequal(distance(n,x),y))

y = 46875 y = 109375 y = 234375 y = 484375 y = 984375 y = 1984375

Suggested Problems

More from this Author2

Community Treasure Hunt

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

Start Hunting!