Cody

Problem 3. Find the sum of all the numbers of the input vector

Solution 242446

Submitted on 10 May 2013 by T A
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   Pass
%% x = 1; y_correct = 1; assert(isequal(vecsum(x),y_correct))

``` y = 0 y = 1 ```

2   Pass
%% x = [1 2 3 5]; y_correct = 11; assert(isequal(vecsum(x),y_correct))

``` y = 0 y = 1 y = 3 y = 6 y = 11 ```

3   Pass
%% x = [1 2 3 5]; y_correct = 11; assert(isequal(vecsum(x),y_correct))

``` y = 0 y = 1 y = 3 y = 6 y = 11 ```

4   Pass
%% x = 1:100; y_correct = 5050; assert(isequal(vecsum(x),y_correct))

``` y = 0 y = 1 y = 3 y = 6 y = 10 y = 15 y = 21 y = 28 y = 36 y = 45 y = 55 y = 66 y = 78 y = 91 y = 105 y = 120 y = 136 y = 153 y = 171 y = 190 y = 210 y = 231 y = 253 y = 276 y = 300 y = 325 y = 351 y = 378 y = 406 y = 435 y = 465 y = 496 y = 528 y = 561 y = 595 y = 630 y = 666 y = 703 y = 741 y = 780 y = 820 y = 861 y = 903 y = 946 y = 990 y = 1035 y = 1081 y = 1128 y = 1176 y = 1225 y = 1275 y = 1326 y = 1378 y = 1431 y = 1485 y = 1540 y = 1596 y = 1653 y = 1711 y = 1770 y = 1830 y = 1891 y = 1953 y = 2016 y = 2080 y = 2145 y = 2211 y = 2278 y = 2346 y = 2415 y = 2485 y = 2556 y = 2628 y = 2701 y = 2775 y = 2850 y = 2926 y = 3003 y = 3081 y = 3160 y = 3240 y = 3321 y = 3403 y = 3486 y = 3570 y = 3655 y = 3741 y = 3828 y = 3916 y = 4005 y = 4095 y = 4186 y = 4278 y = 4371 y = 4465 y = 4560 y = 4656 y = 4753 y = 4851 y = 4950 y = 5050 ```