Cody

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

Solution 431843

Submitted on 14 Apr 2014 by Joel
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 ii = 1 y = 1 ii = 2

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

y = 0 ii = 1 y = 1 ii = 2 y = 3 ii = 3 y = 6 ii = 4 y = 11 ii = 5

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

y = 0 ii = 1 y = 1 ii = 2 y = 3 ii = 3 y = 6 ii = 4 y = 11 ii = 5

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

y = 0 ii = 1 y = 1 ii = 2 y = 3 ii = 3 y = 6 ii = 4 y = 10 ii = 5 y = 15 ii = 6 y = 21 ii = 7 y = 28 ii = 8 y = 36 ii = 9 y = 45 ii = 10 y = 55 ii = 11 y = 66 ii = 12 y = 78 ii = 13 y = 91 ii = 14 y = 105 ii = 15 y = 120 ii = 16 y = 136 ii = 17 y = 153 ii = 18 y = 171 ii = 19 y = 190 ii = 20 y = 210 ii = 21 y = 231 ii = 22 y = 253 ii = 23 y = 276 ii = 24 y = 300 ii = 25 y = 325 ii = 26 y = 351 ii = 27 y = 378 ii = 28 y = 406 ii = 29 y = 435 ii = 30 y = 465 ii = 31 y = 496 ii = 32 y = 528 ii = 33 y = 561 ii = 34 y = 595 ii = 35 y = 630 ii = 36 y = 666 ii = 37 y = 703 ii = 38 y = 741 ii = 39 y = 780 ii = 40 y = 820 ii = 41 y = 861 ii = 42 y = 903 ii = 43 y = 946 ii = 44 y = 990 ii = 45 y = 1035 ii = 46 y = 1081 ii = 47 y = 1128 ii = 48 y = 1176 ii = 49 y = 1225 ii = 50 y = 1275 ii = 51 y = 1326 ii = 52 y = 1378 ii = 53 y = 1431 ii = 54 y = 1485 ii = 55 y = 1540 ii = 56 y = 1596 ii = 57 y = 1653 ii = 58 y = 1711 ii = 59 y = 1770 ii = 60 y = 1830 ii = 61 y = 1891 ii = 62 y = 1953 ii = 63 y = 2016 ii = 64 y = 2080 ii = 65 y = 2145 ii = 66 y = 2211 ii = 67 y = 2278 ii = 68 y = 2346 ii = 69 y = 2415 ii = 70 y = 2485 ii = 71 y = 2556 ii = 72 y = 2628 ii = 73 y = 2701 ii = 74 y = 2775 ii = 75 y = 2850 ii = 76 y = 2926 ii = 77 y = 3003 ii = 78 y = 3081 ii = 79 y = 3160 ii = 80 y = 3240 ii = 81 y = 3321 ii = 82 y = 3403 ii = 83 y = 3486 ii = 84 y = 3570 ii = 85 y = 3655 ii = 86 y = 3741 ii = 87 y = 3828 ii = 88 y = 3916 ii = 89 y = 4005 ii = 90 y = 4095 ii = 91 y = 4186 ii = 92 y = 4278 ii = 93 y = 4371 ii = 94 y = 4465 ii = 95 y = 4560 ii = 96 y = 4656 ii = 97 y = 4753 ii = 98 y = 4851 ii = 99 y = 4950 ii = 100 y = 5050 ii = 101