Cody

Problem 43738. Negative without '-'

Solution 3240348

Submitted on 16 Oct 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 = -1; assert(isequal(your_fcn_name(x),y_correct)) filetext = fileread('your_fcn_name.m'); assert(isempty(strfind(filetext, '*')),'sign * forbidden') assert(isempty(strfind(filetext, 'mtimes')),'mtimes forbidden') assert(isempty(strfind(filetext, 'cross')),'cross forbidden') assert(isempty(strfind(filetext, 'prod')),'prod forbidden') assert(isempty(strfind(filetext, 'cumprod')),'cumprod forbidden') assert(isempty(strfind(filetext, 'times')),'times forbidden') assert(isempty(strfind(filetext, 'mldivide')),'mldivide forbidden') assert(isempty(strfind(filetext, 'mrdivide')),'mrdivide forbidden') assert(isempty(strfind(filetext, '/')),'/ forbidden') assert(isempty(strfind(filetext, '\')),'\ forbidden') assert(isempty(strfind(filetext, '-')),'- forbidden') %assert(isempty(strfind(filetext, '0')),'0 forbidden') assert(isempty(strfind(filetext, '^')),'^ forbidden') assert(isempty(strfind(filetext, 'dot')),'dot forbidden') assert(isempty(strfind(filetext, '''')),'string forbidden')

ans = -2.3026

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

2   Fail
x = 8; y_correct = -8; assert(isequal(your_fcn_name(x),y_correct))

ans = -2.3026

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

3   Fail
x = 8; y_correct = -8; assert(isequal(your_fcn_name(x),y_correct))

ans = -2.3026

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

4   Fail
x = -148; y_correct = 148; assert(isequal(your_fcn_name(x),y_correct))

ans = -2.3026

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

5   Fail
x = randi([1 58]); y_correct = -x; assert(isequal(your_fcn_name(x),y_correct))

ans = -2.3026

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

6   Fail
x = -pi; y_correct = pi; assert(isequal(your_fcn_name(x),y_correct))

ans = -2.3026

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

Suggested Problems

More from this Author11

Community Treasure Hunt

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

Start Hunting!