Cody

# Problem 2035. Check if it is a square or cube of consecutive numbers

Solution 3926268

Submitted on 30 Nov 2020
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   Fail
x = 1; y_correct = true; assert(isequal(Sqube(x),y_correct))

y1 = 1 y2 = 1

Output argument "y" (and maybe others) not assigned during call to "Sqube". Error in Test1 (line 3) assert(isequal(Sqube(x),y_correct))

2   Fail
x = 100; y_correct = true; assert(isequal(Sqube(x),y_correct))

y1 = 10 y2 = 4.6416

Output argument "y" (and maybe others) not assigned during call to "Sqube". Error in Test2 (line 3) assert(isequal(Sqube(x),y_correct))

3   Fail
x = [16 9 -8 1 0 1 4 27]; y_correct = true; assert(isequal(Sqube(x),y_correct))

y1 = 4.0000 3.0000 2.8284 1.0000 0 1.0000 2.0000 5.1962 y2 = 2.5198 2.0801 2.0000 1.0000 0 1.0000 1.5874 3.0000

Output argument "y" (and maybe others) not assigned during call to "Sqube". Error in Test3 (line 3) assert(isequal(Sqube(x),y_correct))

4   Fail
x = [0 0]; y_correct = false; assert(isequal(Sqube(x),y_correct))

y1 = 0 0 y2 = 0 0

Output argument "y" (and maybe others) not assigned during call to "Sqube". Error in Test4 (line 3) assert(isequal(Sqube(x),y_correct))

5   Fail
x = [4 27 16 25 36 343]; y_correct = true; assert(isequal(Sqube(x),y_correct))

y1 = 2.0000 5.1962 4.0000 5.0000 6.0000 18.5203 y2 = 1.5874 3.0000 2.5198 2.9240 3.3019 7.0000

Output argument "y" (and maybe others) not assigned during call to "Sqube". Error in Test5 (line 3) assert(isequal(Sqube(x),y_correct))

6   Fail
x = [4 27 16 -25 36 343 0 7 0]; y_correct = false; assert(isequal(Sqube(x),y_correct))

y1 = 2.0000 5.1962 4.0000 5.0000 6.0000 18.5203 0 2.6458 0 y2 = 1.5874 3.0000 2.5198 2.9240 3.3019 7.0000 0 1.9129 0

Output argument "y" (and maybe others) not assigned during call to "Sqube". Error in Test6 (line 3) assert(isequal(Sqube(x),y_correct))

### Community Treasure Hunt

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

Start Hunting!