Cody

# Problem 44532. Funny problems

Solution 1692556

Submitted on 14 Dec 2018
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 = 1; assert(isequal(funny(x),y))

Undefined function or variable 'x'. Error in funny (line 2) x:-1:1; Error in Test1 (line 3) assert(isequal(funny(x),y))

2   Fail
x=2; y=[2 2 1]; assert(isequal(funny(x),y))

Undefined function or variable 'x'. Error in funny (line 2) x:-1:1; Error in Test2 (line 3) assert(isequal(funny(x),y))

3   Fail
x=5 y=[5 5 5 5 5 4 4 4 4 3 3 3 2 2 1]; assert(isequal(funny(x),y));

x = 5

Undefined function or variable 'x'. Error in funny (line 2) x:-1:1; Error in Test3 (line 3) assert(isequal(funny(x),y));

4   Fail
x=10; y=[10 10 10 10 10 10 10 10 10 10 9 9 9 9 9 9 9 9 9 8 8 8 8 8 8 8 8 7 7 7 7 7 7 7 6 6 6 6 6 6 5 5 5 5 5 4 4 4 4 3 3 3 2 2 1]; assert(isequal(funny(x),y))

Undefined function or variable 'x'. Error in funny (line 2) x:-1:1; Error in Test4 (line 3) assert(isequal(funny(x),y))

5   Pass
filetext = fileread('funny.m'); assert(isempty(strfind(filetext, 'if')),'if forbidden')