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 114548

Submitted on 18 Jul 2012 by Dan

Correct

37Size
Leading solution size is 10.
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
Pass
 
%%
x = 11;
y_correct = 16;
assert(isequal(sums(x),y_correct))
y =
  Columns 1 through 10
     1     2     3     2     5     2     7     2     9     2
  Column 11
    11
y =
  Columns 1 through 10
     1     2     1     2     1     2     1     2     1     2
  Column 11
     1
ans =
    16
2
Pass
 
%%
x = 50;
y_correct = 75;
assert(isequal(sums(x),y_correct))
y =
  Columns 1 through 10
     1     2     3     2     5     2     7     2     9     2
  Columns 11 through 20
    11     2    13     2    15     2    17     2    19     2
  Columns 21 through 30
    21     2    23     2    25     2    27     2    29     2
  Columns 31 through 40
    31     2    33     2    35     2    37     2    39     2
  Columns 41 through 50
    41     2    43     2    45     2    47     2    49     2
y =
  Columns 1 through 10
     1     2     1     2     1     2     1     2     1     2
  Columns 11 through 20
     1     2     1     2     1     2     1     2     1     2
  Columns 21 through 30
     1     2     1     2     1     2     1     2     1     2
  Columns 31 through 40
     1     2     1     2     1     2     1     2     1     2
  Columns 41 through 50
     1     2     1     2     1     2     1     2     1     2
ans =
    75