Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
x = 1;
y = 2;
assert(abs(operation(x,y)/(x+y)-1)<1e-11)
filetext = fileread('operation.m');
assert(isempty(strfind(filetext, '*')),'sign * not allowed')
assert(isempty(strfind(filetext, 'prod')),'prod not allowed')
assert(isempty(strfind(filetext, 'times')),'times not allowed')
assert(isempty(strfind(filetext, 'cross')),'times not allowed')
assert(isempty(strfind(filetext, 'dot')),'times not allowed')
assert(isempty(strfind(filetext, '+')),'sign + not allowed')
assert(isempty(strfind(filetext, '-')),'sign - not allowed')
assert(isempty(strfind(filetext, 'sum')),'sum not allowed')
assert(isempty(strfind(filetext, 'add')),'sum not allowed')
assert(isempty(strfind(filetext, 'diff')),'diff not allowed')
assert(isempty(strfind(filetext, 'minus')),'minus not allowed')
assert(isempty(strfind(filetext, 'plus')),'plus not allowed')
assert(isempty(strfind(filetext, 'sign')),'sign not allowed')
assert(isempty(strfind(filetext, 'abs')),'abs not allowed')
assert(isempty(strfind(filetext, '''')),'strings are not allowed')
z =
3
|
2 | Pass |
x = 2;
y = pi;
assert(abs(operation(x,y)/(x+y)-1)<1e-11)
filetext = fileread('operation.m');
assert(isempty(strfind(filetext, '*')),'sign * not allowed')
assert(isempty(strfind(filetext, 'prod')),'prod not allowed')
assert(isempty(strfind(filetext, 'times')),'times not allowed')
assert(isempty(strfind(filetext, 'cross')),'times not allowed')
assert(isempty(strfind(filetext, 'dot')),'times not allowed')
assert(isempty(strfind(filetext, '+')),'sign + not allowed')
assert(isempty(strfind(filetext, '-')),'sign - not allowed')
assert(isempty(strfind(filetext, 'sum')),'sum not allowed')
assert(isempty(strfind(filetext, 'add')),'sum not allowed')
assert(isempty(strfind(filetext, 'diff')),'diff not allowed')
assert(isempty(strfind(filetext, 'minus')),'minus not allowed')
assert(isempty(strfind(filetext, 'plus')),'plus not allowed')
assert(isempty(strfind(filetext, 'sign')),'sign not allowed')
assert(isempty(strfind(filetext, 'abs')),'abs not allowed')
assert(isempty(strfind(filetext, '''')),'strings are not allowed')
z =
5.1416
|
3 | Fail |
x = -sqrt(13);
y = 0.25;
assert(abs(operation(x,y)/(x+y)-1)<1e-11)
filetext = fileread('operation.m');
assert(isempty(strfind(filetext, '*')),'sign * not allowed')
assert(isempty(strfind(filetext, 'prod')),'prod not allowed')
assert(isempty(strfind(filetext, 'times')),'times not allowed')
assert(isempty(strfind(filetext, 'cross')),'times not allowed')
assert(isempty(strfind(filetext, 'dot')),'times not allowed')
assert(isempty(strfind(filetext, '+')),'sign + not allowed')
assert(isempty(strfind(filetext, '-')),'sign - not allowed')
assert(isempty(strfind(filetext, 'sum')),'sum not allowed')
assert(isempty(strfind(filetext, 'add')),'sum not allowed')
assert(isempty(strfind(filetext, 'diff')),'diff not allowed')
assert(isempty(strfind(filetext, 'minus')),'minus not allowed')
assert(isempty(strfind(filetext, 'plus')),'plus not allowed')
assert(isempty(strfind(filetext, 'sign')),'sign not allowed')
assert(isempty(strfind(filetext, 'abs')),'abs not allowed')
assert(isempty(strfind(filetext, '''')),'strings are not allowed')
z =
3.8556
z =
3
ans =
3.5555e+09
|
4 | Pass |
x = 31/8/87;
y = 22/8/83;
assert(abs(operation(x,y)/(x+y)-1)<1e-11)
filetext = fileread('operation.m');
assert(isempty(strfind(filetext, '*')),'sign * not allowed')
assert(isempty(strfind(filetext, 'prod')),'prod not allowed')
assert(isempty(strfind(filetext, 'times')),'times not allowed')
assert(isempty(strfind(filetext, 'cross')),'times not allowed')
assert(isempty(strfind(filetext, 'dot')),'times not allowed')
assert(isempty(strfind(filetext, '+')),'sign + not allowed')
assert(isempty(strfind(filetext, '-')),'sign - not allowed')
assert(isempty(strfind(filetext, 'sum')),'sum not allowed')
assert(isempty(strfind(filetext, 'add')),'sum not allowed')
assert(isempty(strfind(filetext, 'diff')),'diff not allowed')
assert(isempty(strfind(filetext, 'minus')),'minus not allowed')
assert(isempty(strfind(filetext, 'plus')),'plus not allowed')
assert(isempty(strfind(filetext, 'sign')),'sign not allowed')
assert(isempty(strfind(filetext, 'abs')),'abs not allowed')
assert(isempty(strfind(filetext, '''')),'strings are not allowed')
z =
0.0777
|
We love vectorized solutions. Problem 1 : remove the row average.
381 Solvers
Find nearest prime number less than input number
181 Solvers
Find Index of maximum Value and maximum Value of a vector
123 Solvers
165 Solvers
102 Solvers