Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Solution 223934

Submitted on 26 Mar 2013

Incorrect

72Size
Leading solution size is 38.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test
Code Input and Output
1
Fail
 
%%
assert(isequal(lottery(4,2),7))
Error: SWITCH expression must be a scalar or string constant.
2
Fail
 
%%
assert(isequal(lottery(6,3),90))
Error: SWITCH expression must be a scalar or string constant.
3
Fail
 
%%
assert(isequal(lottery(8,6),266))
Error: SWITCH expression must be a scalar or string constant.
4
Fail
 
%%
assert(isequal(lottery(10,4),34105))
Error: SWITCH expression must be a scalar or string constant.
5
Fail
 
%%
assert(isequal(lottery(lottery(5,2),lottery(4,2)),408741333))
Error: SWITCH expression must be a scalar or string constant.
6
Fail
 
%%
assert(isequal(lottery(18,7),197462483400))
Error: SWITCH expression must be a scalar or string constant.
7
Fail
 
%%
x=[1 2047 86526 611501 1379400 1323652 627396 159027 22275 1705 66 1];
a=ceil(rand*12);
assert(isequal(lottery(12,a),x(a)));
Error: SWITCH expression must be a scalar or string constant.
8
Fail
 
%%
filetext = fileread('lottery.m');
assert(isempty(strfind(filetext, 'switch')))
assert(isempty(strfind(filetext, 'case')))
assert(isempty(strfind(filetext, 'if')))
Error: Assertion failed.