This solution is outdated. To rescore this solution, sign in.
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
filetext = fileread('largest.m');
assert(isempty(strfind(filetext, 'regexp')),'regexp hacks are forbidden')
assert(isempty(strfind(filetext, 'max')),'max() forbidden')
assert(isempty(strfind(filetext, 'min')),'min() forbidden')
assert(isempty(strfind(filetext, 'sort')),'sort() forbidden')
|
2 | Pass |
a = 4; b = 7; c = 1; d = 6;
x_correct = 7;
assert(isequal(largest(a, b, c, d),x_correct))
The largest number is 7
|
3 | Pass |
a = 1; b = 1; c = 1; d = 1;
x_correct = 1;
assert(isequal(largest(a, b, c, d),x_correct))
The largest number is 1
|
4 | Pass |
a = 4; b = 3; c = 2; d = 1;
x_correct = 4;
assert(isequal(largest(a, b, c, d),x_correct))
The largest number is 4
|
5 | Pass |
a = 1; b = 2; c = 3; d = 4;
x_correct = 4;
assert(isequal(largest(a, b, c, d),x_correct))
The largest number is 4
|
6 | Pass |
a = 1; b = 1; c = 3; d = 5;
x_correct = 5;
assert(isequal(largest(a, b, c, d),x_correct))
The largest number is 5
|
7 | Pass |
a = 3; b = 3; c = 2; d = 4;
x_correct = 4;
assert(isequal(largest(a, b, c, d),x_correct))
The largest number is 4
|
8 | Pass |
a = 2; b = 3; c = 1; d = 6;
x_correct = 6;
assert(isequal(largest(a, b, c, d),x_correct))
The largest number is 6
|
9 | Pass |
a = 3; b = 3; c = 3; d = 9;
x_correct = 9;
assert(isequal(largest(a, b, c, d),x_correct))
The largest number is 9
|
2197 Solvers
Determine the number of odd integers in a vector
435 Solvers
Area of an equilateral triangle
2761 Solvers
229 Solvers
209 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!